Better Error Handling

This commit is contained in:
Konloch 2021-07-06 19:51:10 -07:00
parent deb23d3dd3
commit d6be70dfb2
42 changed files with 115 additions and 94 deletions

View file

@ -60,7 +60,7 @@ public class Boot {
try { try {
screen = new InitialBootScreen(); screen = new InitialBootScreen();
} catch (Exception e) { } catch (Exception e) {
new ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
@ -335,7 +335,7 @@ public class Boot {
System.out.println("Succesfully extracted Krakatau"); System.out.println("Succesfully extracted Krakatau");
} catch (Exception e) { } catch (Exception e) {
setState("Bytecode Viewer Boot Screen - ERROR, please contact @Konloch with your stacktrace."); setState("Bytecode Viewer Boot Screen - ERROR, please contact @Konloch with your stacktrace.");
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
} }
@ -371,7 +371,7 @@ public class Boot {
System.out.println("Succesfully extracted Enjarify"); System.out.println("Succesfully extracted Enjarify");
} catch (Exception e) { } catch (Exception e) {
setState("Bytecode Viewer Boot Screen - ERROR, please contact @Konloch with your stacktrace."); setState("Bytecode Viewer Boot Screen - ERROR, please contact @Konloch with your stacktrace.");
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
} }
@ -485,7 +485,7 @@ public class Boot {
BytecodeViewer.showMessage("ERROR: There was an issue unzipping enjarify (possibly corrupt). Restart " BytecodeViewer.showMessage("ERROR: There was an issue unzipping enjarify (possibly corrupt). Restart "
+ "BCV." + nl + + "BCV." + nl +
"If the error persists contact @Konloch."); "If the error persists contact @Konloch.");
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
Objects.requireNonNull(enjarifyZip).delete(); Objects.requireNonNull(enjarifyZip).delete();
} }
} }
@ -530,7 +530,7 @@ public class Boot {
BytecodeViewer.showMessage("ERROR: There was an issue unzipping Krakatau decompiler (possibly " BytecodeViewer.showMessage("ERROR: There was an issue unzipping Krakatau decompiler (possibly "
+ "corrupt). Restart BCV." + nl + + "corrupt). Restart BCV." + nl +
"If the error persists contact @Konloch."); "If the error persists contact @Konloch.");
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
Objects.requireNonNull(krakatauZip).delete(); Objects.requireNonNull(krakatauZip).delete();
} }
} }

View file

@ -199,7 +199,7 @@ public class BytecodeViewer
} }
catch (Exception e) catch (Exception e)
{ {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
@ -492,7 +492,7 @@ public class BytecodeViewer
try { try {
PluginManager.runPlugin(file); PluginManager.runPlugin(file);
} catch (Throwable e) { } catch (Throwable e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
addRecentPlugin(file); addRecentPlugin(file);
} }
@ -542,7 +542,15 @@ public class BytecodeViewer
*/ */
public static void handleException(Throwable t) public static void handleException(Throwable t)
{ {
new ExceptionUI(t); BytecodeViewer.handleException(t);
}
/**
* Handle the exception by creating a new window for bug reporting
*/
public static void handleException(Throwable t, String author)
{
BytecodeViewer.handleException(t, author);
} }
/** /**

View file

@ -162,7 +162,7 @@ public class CommandLineInput {
return CLI; return CLI;
} }
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
return OPEN_FILE; return OPEN_FILE;
@ -208,7 +208,7 @@ public class CommandLineInput {
String contents = Decompiler.PROCYON_DECOMPILER.getDecompiler().decompileClassNode(cn, cw.toByteArray()); String contents = Decompiler.PROCYON_DECOMPILER.getDecompiler().decompileClassNode(cn, cw.toByteArray());
DiskWriter.replaceFile(output.getAbsolutePath(), contents, false); DiskWriter.replaceFile(output.getAbsolutePath(), contents, false);
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
} else if (decompiler.equalsIgnoreCase("cfr")) { } else if (decompiler.equalsIgnoreCase("cfr")) {
@ -226,7 +226,7 @@ public class CommandLineInput {
String contents = Decompiler.CFR_DECOMPILER.getDecompiler().decompileClassNode(cn, cw.toByteArray()); String contents = Decompiler.CFR_DECOMPILER.getDecompiler().decompileClassNode(cn, cw.toByteArray());
DiskWriter.replaceFile(output.getAbsolutePath(), contents, false); DiskWriter.replaceFile(output.getAbsolutePath(), contents, false);
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
} else if (decompiler.equalsIgnoreCase("fernflower")) { } else if (decompiler.equalsIgnoreCase("fernflower")) {
@ -244,7 +244,7 @@ public class CommandLineInput {
String contents = Decompiler.FERNFLOWER_DECOMPILER.getDecompiler().decompileClassNode(cn, cw.toByteArray()); String contents = Decompiler.FERNFLOWER_DECOMPILER.getDecompiler().decompileClassNode(cn, cw.toByteArray());
DiskWriter.replaceFile(output.getAbsolutePath(), contents, false); DiskWriter.replaceFile(output.getAbsolutePath(), contents, false);
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
} else if (decompiler.equalsIgnoreCase("krakatau")) { } else if (decompiler.equalsIgnoreCase("krakatau")) {
@ -262,7 +262,7 @@ public class CommandLineInput {
String contents = Decompiler.KRAKATAU_DECOMPILER.getDecompiler().decompileClassNode(cn, cw.toByteArray()); String contents = Decompiler.KRAKATAU_DECOMPILER.getDecompiler().decompileClassNode(cn, cw.toByteArray());
DiskWriter.replaceFile(output.getAbsolutePath(), contents, false); DiskWriter.replaceFile(output.getAbsolutePath(), contents, false);
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
} else if (decompiler.equalsIgnoreCase("krakatau-bytecode")) { } else if (decompiler.equalsIgnoreCase("krakatau-bytecode")) {
@ -281,7 +281,7 @@ public class CommandLineInput {
String contents = Decompiler.KRAKATAU_DISASSEMBLER.getDecompiler().decompileClassNode(cn, cw.toByteArray()); String contents = Decompiler.KRAKATAU_DISASSEMBLER.getDecompiler().decompileClassNode(cn, cw.toByteArray());
DiskWriter.replaceFile(output.getAbsolutePath(), contents, false); DiskWriter.replaceFile(output.getAbsolutePath(), contents, false);
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
} else if (decompiler.equalsIgnoreCase("jd-gui")) { } else if (decompiler.equalsIgnoreCase("jd-gui")) {
@ -300,7 +300,7 @@ public class CommandLineInput {
String contents = Decompiler.JD_DECOMPILER.getDecompiler().decompileClassNode(cn, cw.toByteArray()); String contents = Decompiler.JD_DECOMPILER.getDecompiler().decompileClassNode(cn, cw.toByteArray());
DiskWriter.replaceFile(output.getAbsolutePath(), contents, false); DiskWriter.replaceFile(output.getAbsolutePath(), contents, false);
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
} else if (decompiler.equalsIgnoreCase("smali")) { } else if (decompiler.equalsIgnoreCase("smali")) {
@ -319,7 +319,7 @@ public class CommandLineInput {
String contents = Decompiler.SMALI_DISASSEMBLER.getDecompiler().decompileClassNode(cn, cw.toByteArray()); String contents = Decompiler.SMALI_DISASSEMBLER.getDecompiler().decompileClassNode(cn, cw.toByteArray());
DiskWriter.replaceFile(output.getAbsolutePath(), contents, false); DiskWriter.replaceFile(output.getAbsolutePath(), contents, false);
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
} else if (decompiler.equalsIgnoreCase("jadx")) { } else if (decompiler.equalsIgnoreCase("jadx")) {
@ -338,7 +338,7 @@ public class CommandLineInput {
String contents = Decompiler.JADX_DECOMPILER.getDecompiler().decompileClassNode(cn, cw.toByteArray()); String contents = Decompiler.JADX_DECOMPILER.getDecompiler().decompileClassNode(cn, cw.toByteArray());
DiskWriter.replaceFile(output.getAbsolutePath(), contents, false); DiskWriter.replaceFile(output.getAbsolutePath(), contents, false);
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
} }
@ -349,7 +349,7 @@ public class CommandLineInput {
Configuration.canExit = true; Configuration.canExit = true;
System.exit(0); System.exit(0);
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }

View file

@ -83,7 +83,7 @@ public class Constants
// Hide file by running attrib system command (on Windows) // Hide file by running attrib system command (on Windows)
Runtime.getRuntime().exec("attrib +H " + f.getAbsolutePath()); Runtime.getRuntime().exec("attrib +H " + f.getAbsolutePath());
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
BytecodeViewer.sm.setBlocking(); BytecodeViewer.sm.setBlocking();
} }

View file

@ -129,7 +129,7 @@ public class Resources {
image = ImageIO.read(bis); image = ImageIO.read(bis);
bis.close(); bis.close();
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
return image; return image;

View file

@ -315,7 +315,7 @@ public class SettingsSerializer
DiskWriter.writeNewLine(settingsName, DiskWriter.writeNewLine(settingsName,
Configuration.language.name(), false); Configuration.language.name(), false);
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }

View file

@ -81,7 +81,7 @@ public class BytecodeViewer {
try { try {
return cl.loadClass(cn.name); return cl.loadClass(cn.name);
} catch (Exception classLoadException) { } catch (Exception classLoadException) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(classLoadException); the.bytecode.club.bytecodeviewer.BytecodeViewer.handleException(classLoadException);
} }
return null; return null;
@ -115,7 +115,7 @@ public class BytecodeViewer {
try { try {
ret.add(cl.loadClass(className)); ret.add(cl.loadClass(className));
} catch (Exception classLoadException) { } catch (Exception classLoadException) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(classLoadException); the.bytecode.club.bytecodeviewer.BytecodeViewer.handleException(classLoadException);
} }
} }
@ -123,7 +123,7 @@ public class BytecodeViewer {
return ret; return ret;
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); the.bytecode.club.bytecodeviewer.BytecodeViewer.handleException(e);
} }
return null; return null;
} }

View file

@ -42,7 +42,7 @@ public abstract class Plugin extends Thread
execute(BytecodeViewer.getLoadedClasses()); execute(BytecodeViewer.getLoadedClasses());
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} finally { } finally {
finished = true; finished = true;
BytecodeViewer.updateBusyStatus(false); BytecodeViewer.updateBusyStatus(false);

View file

@ -152,7 +152,7 @@ public class JavaCompiler extends InternalCompiler
return org.apache.commons.io.FileUtils.readFileToByteArray(clazz); return org.apache.commons.io.FileUtils.readFileToByteArray(clazz);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
//new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); //BytecodeViewer.handleException(e);
} }
return null; return null;

View file

@ -118,7 +118,7 @@ public class KrakatauAssembler extends InternalCompiler
return b; return b;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
//new the.bytecode.club.bytecodeviewer.api.ExceptionUI(log.toString()); //BytecodeViewer.handleException(log.toString());
} finally { } finally {
BytecodeViewer.sm.setBlocking(); BytecodeViewer.sm.setBlocking();
} }

View file

@ -57,7 +57,7 @@ public class SmaliAssembler extends InternalCompiler
DiskWriter.replaceFile(tempSmali.getAbsolutePath(), contents, false); DiskWriter.replaceFile(tempSmali.getAbsolutePath(), contents, false);
} catch (final Exception e) { } catch (final Exception e) {
e.printStackTrace(); e.printStackTrace();
//new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); //BytecodeViewer.handleException(e);
} }
try { try {
@ -67,7 +67,7 @@ public class SmaliAssembler extends InternalCompiler
}); });
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
//new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); //BytecodeViewer.handleException(e);
} }
@ -104,7 +104,7 @@ public class SmaliAssembler extends InternalCompiler
} catch (java.lang.NullPointerException ignored) { } } catch (java.lang.NullPointerException ignored) { }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
//new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); //BytecodeViewer.handleException(e);
} }
finally finally
{ {

View file

@ -390,7 +390,7 @@ public class InstructionPrinter {
} }
bw.close(); bw.close();
} catch (IOException e) { } catch (IOException e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }

View file

@ -102,7 +102,7 @@ public class CFRDecompiler extends InternalDecompiler
fos.close(); fos.close();
} catch (final IOException e) { } catch (final IOException e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
String fuckery = fuckery(fileStart); String fuckery = fuckery(fileStart);
@ -118,7 +118,7 @@ public class CFRDecompiler extends InternalDecompiler
BytecodeViewer.createdProcesses.add(p); BytecodeViewer.createdProcesses.add(p);
p.waitFor(); p.waitFor();
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} finally { } finally {
BytecodeViewer.sm.setBlocking(); BytecodeViewer.sm.setBlocking();
} }
@ -314,7 +314,7 @@ public class CFRDecompiler extends InternalDecompiler
try { try {
zip(fuck, new File(zipName)); zip(fuck, new File(zipName));
} catch (IOException e) { } catch (IOException e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
fuck.delete(); fuck.delete();

View file

@ -96,7 +96,7 @@ public class FernFlowerDecompiler extends InternalDecompiler
BytecodeViewer.createdProcesses.add(p); BytecodeViewer.createdProcesses.add(p);
p.waitFor(); p.waitFor();
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} finally { } finally {
BytecodeViewer.sm.setBlocking(); BytecodeViewer.sm.setBlocking();
} }

View file

@ -11,6 +11,7 @@ import java.util.Objects;
import java.util.Random; import java.util.Random;
import me.konloch.kontainer.io.DiskReader; import me.konloch.kontainer.io.DiskReader;
import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.api.ExceptionUI; import the.bytecode.club.bytecodeviewer.api.ExceptionUI;
import the.bytecode.club.bytecodeviewer.decompilers.InternalDecompiler; import the.bytecode.club.bytecodeviewer.decompilers.InternalDecompiler;
import the.bytecode.club.bytecodeviewer.util.MiscUtils; import the.bytecode.club.bytecodeviewer.util.MiscUtils;
@ -54,7 +55,7 @@ public class JADXDecompiler extends InternalDecompiler
fos.write(b); fos.write(b);
fos.close(); fos.close();
} catch (final IOException e) { } catch (final IOException e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
File fuckery = new File(fuckery(fileStart)); File fuckery = new File(fuckery(fileStart));

View file

@ -7,6 +7,7 @@ import java.io.PrintStream;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.api.ExceptionUI; import the.bytecode.club.bytecodeviewer.api.ExceptionUI;
import the.bytecode.club.bytecodeviewer.decompilers.InternalDecompiler; import the.bytecode.club.bytecodeviewer.decompilers.InternalDecompiler;
import the.bytecode.club.bytecodeviewer.decompilers.jdgui.DirectoryLoader; import the.bytecode.club.bytecodeviewer.decompilers.jdgui.DirectoryLoader;
@ -74,7 +75,7 @@ public class JDGUIDecompiler extends InternalDecompiler
fos.write(b); fos.write(b);
fos.close(); fos.close();
} catch (final IOException e) { } catch (final IOException e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }

View file

@ -282,7 +282,7 @@ public class KrakatauDecompiler extends InternalDecompiler
ZipUtils.zipFolder(tempDirectory.getAbsolutePath(), zipName, ran); ZipUtils.zipFolder(tempDirectory.getAbsolutePath(), zipName, ran);
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} finally { } finally {
BytecodeViewer.sm.setBlocking(); BytecodeViewer.sm.setBlocking();
} }

View file

@ -218,7 +218,7 @@ public class KrakatauDisassembler extends InternalDecompiler
ZipUtils.zipFolder(tempDirectory.getAbsolutePath(), zipName, ran); ZipUtils.zipFolder(tempDirectory.getAbsolutePath(), zipName, ran);
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} finally { } finally {
BytecodeViewer.sm.setBlocking(); BytecodeViewer.sm.setBlocking();
} }

View file

@ -101,7 +101,7 @@ public class ProcyonDecompiler extends InternalDecompiler
fos.close(); fos.close();
} catch (final IOException e) { } catch (final IOException e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
DecompilerSettings settings = getDecompilerSettings(); DecompilerSettings settings = getDecompilerSettings();
@ -140,7 +140,7 @@ public class ProcyonDecompiler extends InternalDecompiler
try { try {
doSaveJarDecompiled(new File(sourceJar), new File(zipName)); doSaveJarDecompiled(new File(sourceJar), new File(zipName));
} catch (StackOverflowError | Exception e) { } catch (StackOverflowError | Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }

View file

@ -9,6 +9,7 @@ import java.util.Objects;
import me.konloch.kontainer.io.DiskReader; import me.konloch.kontainer.io.DiskReader;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.api.ExceptionUI; import the.bytecode.club.bytecodeviewer.api.ExceptionUI;
import the.bytecode.club.bytecodeviewer.decompilers.InternalDecompiler; import the.bytecode.club.bytecodeviewer.decompilers.InternalDecompiler;
import the.bytecode.club.bytecodeviewer.util.Dex2Jar; import the.bytecode.club.bytecodeviewer.util.Dex2Jar;
@ -62,7 +63,7 @@ public class SmaliDisassembler extends InternalDecompiler
fos.close(); fos.close();
} catch (final IOException e) { } catch (final IOException e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
//ZipUtils.zipFile(tempClass, tempZip); //ZipUtils.zipFile(tempClass, tempZip);

View file

@ -133,7 +133,7 @@ public class ResourceViewProcessing extends PaneUpdaterThread
} }
catch (Exception e) catch (Exception e)
{ {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
finally finally
{ {

View file

@ -1,6 +1,7 @@
package the.bytecode.club.bytecodeviewer.plugin; package the.bytecode.club.bytecodeviewer.plugin;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Resources; import the.bytecode.club.bytecodeviewer.Resources;
import the.bytecode.club.bytecodeviewer.api.ExceptionUI; import the.bytecode.club.bytecodeviewer.api.ExceptionUI;
@ -47,7 +48,7 @@ public enum PluginTemplate
} }
catch (IOException e) catch (IOException e)
{ {
new ExceptionUI(e); BytecodeViewer.handleException(e);
} }
return null; return null;

View file

@ -104,7 +104,7 @@ public class PluginWriter extends JFrame
} }
catch (Exception e) catch (Exception e)
{ {
new ExceptionUI(e); BytecodeViewer.handleException(e);
} }
catch (Throwable t) catch (Throwable t)
{ {

View file

@ -84,7 +84,7 @@ public class AllatoriStringDecrypter extends Plugin
} }
catch (Exception e) catch (Exception e)
{ {
new ExceptionUI(e, "github.com/Szperak"); BytecodeViewer.handleException(e, "github.com/Szperak");
} }
finally finally
{ {

View file

@ -10,6 +10,7 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream; import java.util.zip.ZipInputStream;
import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassReader;
import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.api.Plugin; import the.bytecode.club.bytecodeviewer.api.Plugin;
import the.bytecode.club.bytecodeviewer.plugin.PluginLaunchStrategy; import the.bytecode.club.bytecodeviewer.plugin.PluginLaunchStrategy;
import the.bytecode.club.bytecodeviewer.util.JarUtils; import the.bytecode.club.bytecodeviewer.util.JarUtils;
@ -103,7 +104,7 @@ public class CompiledJavaPluginLaunchStrategy implements PluginLaunchStrategy {
} }
} }
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} finally { } finally {
jis.closeEntry(); jis.closeEntry();
} }

View file

@ -1,6 +1,7 @@
package the.bytecode.club.bytecodeviewer.plugin.strategies; package the.bytecode.club.bytecodeviewer.plugin.strategies;
import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.api.Plugin; import the.bytecode.club.bytecodeviewer.api.Plugin;
import the.bytecode.club.bytecodeviewer.plugin.PluginLaunchStrategy; import the.bytecode.club.bytecodeviewer.plugin.PluginLaunchStrategy;
@ -65,7 +66,7 @@ public class JavascriptPluginLaunchStrategy implements PluginLaunchStrategy
} }
catch (NoSuchMethodException | ScriptException e) catch (NoSuchMethodException | ScriptException e)
{ {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
}; };

View file

@ -85,7 +85,7 @@ public class ResourceDecompiling
MiscUtils.append(javaSucks, "-proycon.zip")); MiscUtils.append(javaSucks, "-proycon.zip"));
BytecodeViewer.updateBusyStatus(false); BytecodeViewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
new ExceptionUI(e); BytecodeViewer.handleException(e);
} }
}); });
t12.start(); t12.start();
@ -96,7 +96,7 @@ public class ResourceDecompiling
MiscUtils.append(javaSucks, "-CFR.zip")); MiscUtils.append(javaSucks, "-CFR.zip"));
BytecodeViewer.updateBusyStatus(false); BytecodeViewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
new ExceptionUI(e); BytecodeViewer.handleException(e);
} }
}); });
t2.start(); t2.start();
@ -107,7 +107,7 @@ public class ResourceDecompiling
MiscUtils.append(javaSucks, "-fernflower.zip")); MiscUtils.append(javaSucks, "-fernflower.zip"));
BytecodeViewer.updateBusyStatus(false); BytecodeViewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
new ExceptionUI(e); BytecodeViewer.handleException(e);
} }
}); });
t3.start(); t3.start();
@ -118,7 +118,7 @@ public class ResourceDecompiling
MiscUtils.append(javaSucks, "-kraktau.zip")); MiscUtils.append(javaSucks, "-kraktau.zip"));
BytecodeViewer.updateBusyStatus(false); BytecodeViewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
new ExceptionUI(e); BytecodeViewer.handleException(e);
} }
}); });
t4.start(); t4.start();
@ -129,7 +129,7 @@ public class ResourceDecompiling
Decompiler.PROCYON_DECOMPILER.getDecompiler().decompileToZip(tempZip.getAbsolutePath(), path); Decompiler.PROCYON_DECOMPILER.getDecompiler().decompileToZip(tempZip.getAbsolutePath(), path);
BytecodeViewer.updateBusyStatus(false); BytecodeViewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
new ExceptionUI(e); BytecodeViewer.handleException(e);
} }
}); });
t12.start(); t12.start();
@ -140,7 +140,7 @@ public class ResourceDecompiling
Decompiler.CFR_DECOMPILER.getDecompiler().decompileToZip(tempZip.getAbsolutePath(), path); Decompiler.CFR_DECOMPILER.getDecompiler().decompileToZip(tempZip.getAbsolutePath(), path);
BytecodeViewer.updateBusyStatus(false); BytecodeViewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
new ExceptionUI(e); BytecodeViewer.handleException(e);
} }
}); });
t12.start(); t12.start();
@ -151,7 +151,7 @@ public class ResourceDecompiling
Decompiler.FERNFLOWER_DECOMPILER.getDecompiler().decompileToZip(tempZip.getAbsolutePath(), path); Decompiler.FERNFLOWER_DECOMPILER.getDecompiler().decompileToZip(tempZip.getAbsolutePath(), path);
BytecodeViewer.updateBusyStatus(false); BytecodeViewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
new ExceptionUI(e); BytecodeViewer.handleException(e);
} }
}); });
t12.start(); t12.start();
@ -163,7 +163,7 @@ public class ResourceDecompiling
Decompiler.KRAKATAU_DECOMPILER.getDecompiler().decompileToZip(tempZip.getAbsolutePath(), path); Decompiler.KRAKATAU_DECOMPILER.getDecompiler().decompileToZip(tempZip.getAbsolutePath(), path);
BytecodeViewer.updateBusyStatus(false); BytecodeViewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
new ExceptionUI(e); BytecodeViewer.handleException(e);
} }
}); });
t12.start(); t12.start();
@ -276,7 +276,7 @@ public class ResourceDecompiling
BytecodeViewer.updateBusyStatus(false); BytecodeViewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
BytecodeViewer.updateBusyStatus(false); BytecodeViewer.updateBusyStatus(false);
new ExceptionUI(e); BytecodeViewer.handleException(e);
} }
}); });
t1.start(); t1.start();
@ -301,7 +301,7 @@ public class ResourceDecompiling
BytecodeViewer.updateBusyStatus(false); BytecodeViewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
BytecodeViewer.updateBusyStatus(false); BytecodeViewer.updateBusyStatus(false);
new ExceptionUI( BytecodeViewer.handleException(
e); e);
} }
}); });
@ -327,7 +327,7 @@ public class ResourceDecompiling
BytecodeViewer.updateBusyStatus(false); BytecodeViewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
BytecodeViewer.updateBusyStatus(false); BytecodeViewer.updateBusyStatus(false);
new ExceptionUI( BytecodeViewer.handleException(
e); e);
} }
}); });
@ -355,7 +355,7 @@ public class ResourceDecompiling
BytecodeViewer.updateBusyStatus(false); BytecodeViewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
BytecodeViewer.updateBusyStatus(false); BytecodeViewer.updateBusyStatus(false);
new ExceptionUI( BytecodeViewer.handleException(
e); e);
} }
}); });
@ -383,7 +383,7 @@ public class ResourceDecompiling
BytecodeViewer.updateBusyStatus(false); BytecodeViewer.updateBusyStatus(false);
} catch (Exception e) { } catch (Exception e) {
BytecodeViewer.updateBusyStatus(false); BytecodeViewer.updateBusyStatus(false);
new ExceptionUI( BytecodeViewer.handleException(
e); e);
} }
}); });

View file

@ -95,7 +95,7 @@ public class ImportResource implements Runnable
} }
catch (final Exception e) catch (final Exception e)
{ {
new ExceptionUI(e); BytecodeViewer.handleException(e);
} }
finally finally
{ {

View file

@ -53,7 +53,7 @@ public class APKResourceImporter implements Importer
BytecodeViewer.updateBusyStatus(false); BytecodeViewer.updateBusyStatus(false);
BytecodeViewer.files.add(container); BytecodeViewer.files.add(container);
} catch (final Exception e) { } catch (final Exception e) {
new ExceptionUI(e); BytecodeViewer.handleException(e);
} }
return true; return true;

View file

@ -40,7 +40,7 @@ public class ClassResourceImporter implements Importer
} }
catch (final Exception e) catch (final Exception e)
{ {
new ExceptionUI(e); BytecodeViewer.handleException(e);
return false; return false;
} }

View file

@ -42,7 +42,7 @@ public class DEXResourceImporter implements Importer
BytecodeViewer.updateBusyStatus(false); BytecodeViewer.updateBusyStatus(false);
BytecodeViewer.files.add(container); BytecodeViewer.files.add(container);
} catch (final Exception e) { } catch (final Exception e) {
new ExceptionUI(e); BytecodeViewer.handleException(e);
} }
return true; return true;

View file

@ -1,5 +1,6 @@
package the.bytecode.club.bytecodeviewer.resources.importing.impl; package the.bytecode.club.bytecodeviewer.resources.importing.impl;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.api.ExceptionUI; import the.bytecode.club.bytecodeviewer.api.ExceptionUI;
import the.bytecode.club.bytecodeviewer.resources.importing.Importer; import the.bytecode.club.bytecodeviewer.resources.importing.Importer;
import the.bytecode.club.bytecodeviewer.util.JarUtils; import the.bytecode.club.bytecodeviewer.util.JarUtils;
@ -30,13 +31,13 @@ public class ZipResourceImporter implements Importer
} }
catch (final Exception e) catch (final Exception e)
{ {
new ExceptionUI(e); BytecodeViewer.handleException(e);
return false; return false;
} }
} }
catch (final Exception e) catch (final Exception e)
{ {
new ExceptionUI(e); BytecodeViewer.handleException(e);
return false; return false;
} }

View file

@ -18,6 +18,7 @@ import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.MultiANewArrayInsnNode; import org.objectweb.asm.tree.MultiANewArrayInsnNode;
import org.objectweb.asm.tree.TypeInsnNode; import org.objectweb.asm.tree.TypeInsnNode;
import org.objectweb.asm.tree.VarInsnNode; import org.objectweb.asm.tree.VarInsnNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
/*************************************************************************** /***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
@ -245,7 +246,7 @@ public class RegexInsnFinder {
"Unknown opcode encountered: " "Unknown opcode encountered: "
+ ain.getOpcode()); + ain.getOpcode());
} catch (final UnexpectedException e) { } catch (final UnexpectedException e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
offsets[i] = insnStringBuilder.length(); offsets[i] = insnStringBuilder.length();
@ -273,7 +274,7 @@ public class RegexInsnFinder {
"Unknown opcode encountered: " "Unknown opcode encountered: "
+ ain.getOpcode()); + ain.getOpcode());
} catch (final UnexpectedException e) { } catch (final UnexpectedException e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
String insnString = getInsString(ain); String insnString = getInsString(ain);
@ -385,7 +386,7 @@ public class RegexInsnFinder {
results.add(makeResult(regexMatcher.start(), regexMatcher.end())); results.add(makeResult(regexMatcher.start(), regexMatcher.end()));
} }
} catch (final PatternSyntaxException ex) { } catch (final PatternSyntaxException ex) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(ex); BytecodeViewer.handleException(ex);
} }
return results; return results;
} }
@ -411,7 +412,7 @@ public class RegexInsnFinder {
return result; return result;
} }
} catch (final PatternSyntaxException ex) { } catch (final PatternSyntaxException ex) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(ex); BytecodeViewer.handleException(ex);
} }
return new AbstractInsnNode[0][0]; return new AbstractInsnNode[0][0];
} }
@ -438,7 +439,7 @@ public class RegexInsnFinder {
results.add(result); results.add(result);
} }
} catch (final PatternSyntaxException ex) { } catch (final PatternSyntaxException ex) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(ex); BytecodeViewer.handleException(ex);
} }
return results; return results;
} }

View file

@ -48,7 +48,7 @@ public class APKTool {
container.APKToolContents = dir; container.APKToolContents = dir;
tempAPKPath.delete(); tempAPKPath.delete();
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
@ -74,7 +74,7 @@ public class APKTool {
BytecodeViewer.sm.setBlocking(); BytecodeViewer.sm.setBlocking();
tempAPKPath.delete(); tempAPKPath.delete();
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
} }

View file

@ -1,6 +1,7 @@
package the.bytecode.club.bytecodeviewer.util; package the.bytecode.club.bytecodeviewer.util;
import com.googlecode.d2j.dex.Dex2jar; import com.googlecode.d2j.dex.Dex2jar;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -45,7 +46,7 @@ public class Dex2Jar {
} catch (com.googlecode.d2j.DexException e) { } catch (com.googlecode.d2j.DexException e) {
e.printStackTrace(); e.printStackTrace();
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
@ -96,7 +97,7 @@ public class Dex2Jar {
if (delete) if (delete)
input.delete(); input.delete();
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
} }

View file

@ -73,7 +73,7 @@ public class DialogueUtils
Configuration.lastDirectory = file.getAbsolutePath(); Configuration.lastDirectory = file.getAbsolutePath();
return file; return file;
} catch (Exception e1) { } catch (Exception e1) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e1); BytecodeViewer.handleException(e1);
} }
return null; return null;

View file

@ -69,7 +69,7 @@ public class Enjarify {
MiscUtils.printProcess(process); MiscUtils.printProcess(process);
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} finally { } finally {
BytecodeViewer.sm.setBlocking(); BytecodeViewer.sm.setBlocking();
} }

View file

@ -1,5 +1,7 @@
package the.bytecode.club.bytecodeviewer.util; package the.bytecode.club.bytecodeviewer.util;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.DataFlavor;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
@ -367,13 +369,13 @@ public class FileDrop {
} // end try } // end try
catch (final java.io.IOException io) { catch (final java.io.IOException io) {
log(out, "FileDrop: IOException - abort:"); log(out, "FileDrop: IOException - abort:");
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(io); BytecodeViewer.handleException(io);
evt.rejectDrop(); evt.rejectDrop();
} // end catch IOException } // end catch IOException
catch (final java.awt.datatransfer.UnsupportedFlavorException ufe) { catch (final java.awt.datatransfer.UnsupportedFlavorException ufe) {
log(out, log(out,
"FileDrop: UnsupportedFlavorException - abort:"); "FileDrop: UnsupportedFlavorException - abort:");
new the.bytecode.club.bytecodeviewer.api.ExceptionUI( BytecodeViewer.handleException(
ufe); ufe);
evt.rejectDrop(); evt.rejectDrop();
} // end catch: UnsupportedFlavorException } // end catch: UnsupportedFlavorException
@ -480,7 +482,7 @@ public class FileDrop {
dt.addDropTargetListener(dropListener); dt.addDropTargetListener(dropListener);
} // end try } // end try
catch (final java.util.TooManyListenersException e) { catch (final java.util.TooManyListenersException e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
log(out, log(out,
"FileDrop: Drop will not work due to previous error. Do you have another listener attached?"); "FileDrop: Drop will not work due to previous error. Do you have another listener attached?");
} // end catch } // end catch

View file

@ -1,5 +1,7 @@
package the.bytecode.club.bytecodeviewer.util; package the.bytecode.club.bytecodeviewer.util;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import javax.swing.*; import javax.swing.*;
import javax.swing.text.DefaultHighlighter; import javax.swing.text.DefaultHighlighter;
import javax.swing.text.Document; import javax.swing.text.Document;
@ -127,7 +129,7 @@ public class JTextAreaUtils
} }
catch (Exception e) catch (Exception e)
{ {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
@ -164,7 +166,7 @@ public class JTextAreaUtils
} }
catch (Exception e) catch (Exception e)
{ {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
} }

View file

@ -94,7 +94,7 @@ public class JarUtils
} catch (java.io.EOFException | ZipException e) { } catch (java.io.EOFException | ZipException e) {
//ignore cause apache unzip //ignore cause apache unzip
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} finally { } finally {
jis.closeEntry(); jis.closeEntry();
} }
@ -177,7 +177,7 @@ public class JarUtils
} }
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} finally { } finally {
jis.closeEntry(); jis.closeEntry();
} }
@ -210,7 +210,7 @@ public class JarUtils
jis.closeEntry(); jis.closeEntry();
} }
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} finally { } finally {
jis.closeEntry(); jis.closeEntry();
} }
@ -289,7 +289,7 @@ public class JarUtils
out.close(); out.close();
} catch (IOException e) { } catch (IOException e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
@ -327,7 +327,7 @@ public class JarUtils
} }
catch (IOException e) catch (IOException e)
{ {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
} }
@ -351,7 +351,7 @@ public class JarUtils
DiskWriter.replaceFile(name, cw.toByteArray(), false); DiskWriter.replaceFile(name, cw.toByteArray(), false);
} }
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
@ -395,7 +395,7 @@ public class JarUtils
noDupe.clear(); noDupe.clear();
out.close(); out.close();
} catch (IOException e) { } catch (IOException e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
} }
} }

View file

@ -215,7 +215,7 @@ public class MiscUtils
try { try {
return ImageIO.read(new ByteArrayInputStream(contents)); return ImageIO.read(new ByteArrayInputStream(contents));
} catch (IOException e) { } catch (IOException e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); BytecodeViewer.handleException(e);
} }
return defaultImage; return defaultImage;

View file

@ -85,7 +85,7 @@ public class VersionChecker implements Runnable
try { try {
fc.setCurrentDirectory(new File(".").getAbsoluteFile()); //set the current working directory fc.setCurrentDirectory(new File(".").getAbsoluteFile()); //set the current working directory
} catch (Exception e) { } catch (Exception e) {
new ExceptionUI(e); BytecodeViewer.handleException(e);
} }
int returnVal = fc.showSaveDialog(BytecodeViewer.viewer); int returnVal = fc.showSaveDialog(BytecodeViewer.viewer);
@ -190,11 +190,11 @@ public class VersionChecker implements Runnable
BytecodeViewer.showMessage("Unable to download, the zip file has not been uploaded yet, " BytecodeViewer.showMessage("Unable to download, the zip file has not been uploaded yet, "
+ "please try again in about 10 minutes."); + "please try again in about 10 minutes.");
} catch (Exception ex) { } catch (Exception ex) {
new ExceptionUI(ex); BytecodeViewer.handleException(ex);
} }
} catch (Exception e) { } catch (Exception e) {
new ExceptionUI(e); BytecodeViewer.handleException(e);
} }
}, "Downloader"); }, "Downloader");