Updated Error Handling

This commit is contained in:
Konloch 2021-07-06 17:52:00 -07:00
parent ec91bd08e8
commit febdeba457
7 changed files with 28 additions and 17 deletions

View file

@ -40,6 +40,9 @@ import static the.bytecode.club.bytecodeviewer.Constants.*;
public class ExceptionUI extends JFrame public class ExceptionUI extends JFrame
{ {
public static final String SEND_STACKTRACE_TO = "Send the stacktrace to https://github.com/Konloch/bytecode-viewer/issues or Konloch at https://the.bytcode.club or konloch@gmail.com" +
"\nIf you hold appropriate legal rights to the relevant class/jar/apk file please include that as well.";
/** /**
* @param e The exception to be shown * @param e The exception to be shown
*/ */
@ -104,9 +107,8 @@ public class ExceptionUI extends JFrame
textArea.setText( textArea.setText(
"Please send this error log to " + author + "Please send this error log to " + author +
"\nIf you " + "\nIf you hold appropriate legal rights to the relevant class/jar/apk file please include that as well." +
"\nIif you hold appropriate legal rights the relevant class file." + "\nBytecode Viewer Version: " + VERSION +
"Bytecode Viewer Version: " + VERSION +
", Preview Copy: " + PREVIEW_COPY + ", Preview Copy: " + PREVIEW_COPY +
", Fat Jar: " + FAT_JAR + ", Fat Jar: " + FAT_JAR +
", OS: " + System.getProperty("os.name") + ", OS: " + System.getProperty("os.name") +

View file

@ -18,6 +18,7 @@ import java.util.zip.ZipOutputStream;
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.BytecodeViewer;
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;
@ -142,7 +143,8 @@ public class CFRDecompiler extends InternalDecompiler
if (file.exists()) if (file.exists())
return findFile(Objects.requireNonNull(file.listFiles())); return findFile(Objects.requireNonNull(file.listFiles()));
return "CFR error! Send the stacktrace to Konloch at https://the.bytecode.club or konloch@gmail.com" + nl + nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler." + nl + nl + exception; return "CFR error! " + ExceptionUI.SEND_STACKTRACE_TO +
nl + nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler." + nl + nl + exception;
} }
Random r = new Random(); Random r = new Random();
@ -171,15 +173,17 @@ public class CFRDecompiler extends InternalDecompiler
String exception = String exception =
"Bytecode Viewer Version: " + VERSION + nl + nl + sw; "Bytecode Viewer Version: " + VERSION + nl + nl + sw;
return "CFR error! Send the stacktrace to Konloch at https://the.bytecode.club or konloch@gmail" return "CFR error! " + ExceptionUI.SEND_STACKTRACE_TO +
+ ".com" + nl + nl + "Suggested Fix: Click refresh class, " nl + nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler." +
+ "if it fails again try another decompiler." + nl + nl + exception; nl + nl + exception;
} }
return s; return s;
} }
} }
return "CFR error!" + nl + nl + "Suggested Fix: Click refresh class, if it "
+ "fails again try another decompiler."; return "CFR error!" +
nl + nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler.";
} }
public String[] generateMainMethod(String filePath, String outputPath) { public String[] generateMainMethod(String filePath, String outputPath) {

View file

@ -10,6 +10,7 @@ import org.apache.commons.lang3.ArrayUtils;
import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer; 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.decompilers.InternalDecompiler; import the.bytecode.club.bytecodeviewer.decompilers.InternalDecompiler;
import the.bytecode.club.bytecodeviewer.util.MiscUtils; import the.bytecode.club.bytecodeviewer.util.MiscUtils;
@ -129,7 +130,7 @@ public class FernFlowerDecompiler extends InternalDecompiler
exception += nl + nl + sw; exception += nl + nl + sw;
} }
} }
return "FernFlower error! Send the stacktrace to Konloch at https://the.bytecode.club or konloch@gmail.com" return "FernFlower error! " + ExceptionUI.SEND_STACKTRACE_TO
+ nl + nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler." + nl + nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler."
+ nl + nl + exception; + nl + nl + exception;
} }

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.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;
@ -84,7 +85,7 @@ public class JADXDecompiler extends InternalDecompiler
if(exception.isEmpty()) if(exception.isEmpty())
exception = "Decompiled source file not found!"; exception = "Decompiled source file not found!";
return "JADX error! Send the stacktrace to Konloch at https://the.bytecode.club or konloch@gmail.com" return "JADX error! " + ExceptionUI.SEND_STACKTRACE_TO
+ nl + nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler." + nl + nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler."
+ nl + nl + exception; + nl + nl + exception;
} }
@ -114,9 +115,9 @@ public class JADXDecompiler extends InternalDecompiler
e.printStackTrace(); e.printStackTrace();
String exception = "Bytecode Viewer Version: " + VERSION + nl + nl + sw; String exception = "Bytecode Viewer Version: " + VERSION + nl + nl + sw;
return "JADX error! Send the stacktrace to Konloch at https://the.bytecode.club or konloch@gmail" return "JADX error! " + ExceptionUI.SEND_STACKTRACE_TO +
+ ".com" + nl + nl + "Suggested Fix: Click refresh class, " nl + nl + "Suggested Fix: Click refresh class, " +
+ "if it fails again try another decompiler." + nl + nl + exception; "if it fails again try another decompiler." + nl + nl + exception;
} }
return s; return s;
} }

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.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;
import the.bytecode.club.bytecodeviewer.decompilers.jdgui.CommonPreferences; import the.bytecode.club.bytecodeviewer.decompilers.jdgui.CommonPreferences;
@ -116,7 +117,7 @@ public class JDGUIDecompiler extends InternalDecompiler
"Bytecode Viewer Version: " + VERSION + nl + nl + sw; "Bytecode Viewer Version: " + VERSION + nl + nl + sw;
} }
return "JD-GUI error! Send the stacktrace to Konloch at https://the.bytecode.club or konloch@gmail.com" return "JD-GUI error! " + ExceptionUI.SEND_STACKTRACE_TO
+ nl + nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler." + nl + nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler."
+ nl + nl + exception; + nl + nl + exception;
} }

View file

@ -32,6 +32,7 @@ import java.util.zip.ZipException;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.BytecodeViewer;
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.EncodeUtils; import the.bytecode.club.bytecodeviewer.util.EncodeUtils;
import the.bytecode.club.bytecodeviewer.util.MiscUtils; import the.bytecode.club.bytecodeviewer.util.MiscUtils;
@ -129,7 +130,7 @@ public class ProcyonDecompiler extends InternalDecompiler
exception = "Bytecode Viewer Version: " + VERSION + nl + nl + sw; exception = "Bytecode Viewer Version: " + VERSION + nl + nl + sw;
} }
return "Procyon error! Send the stacktrace to Konloch at https://the.bytecode.club or konloch@gmail.com" return "Procyon error! " + ExceptionUI.SEND_STACKTRACE_TO
+ nl + nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler." + nl + nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler."
+ nl + nl + exception; + nl + nl + exception;
} }

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.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;
import the.bytecode.club.bytecodeviewer.util.FileContainer; import the.bytecode.club.bytecodeviewer.util.FileContainer;
@ -114,7 +115,7 @@ public class SmaliDisassembler extends InternalDecompiler
exception += "Bytecode Viewer Version: " + VERSION + nl + nl + sw; exception += "Bytecode Viewer Version: " + VERSION + nl + nl + sw;
} }
return "Smali Disassembler error! Send the stacktrace to Konloch at https://the.bytecode.club or konloch@gmail.com" return "Smali Disassembler error! " + ExceptionUI.SEND_STACKTRACE_TO
+ nl + nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler." + nl + nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler."
+ nl + nl + exception; + nl + nl + exception;
} }