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 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
*/
@ -104,9 +107,8 @@ public class ExceptionUI extends JFrame
textArea.setText(
"Please send this error log to " + author +
"\nIf you " +
"\nIif you hold appropriate legal rights the relevant class file." +
"Bytecode Viewer Version: " + VERSION +
"\nIf you hold appropriate legal rights to the relevant class/jar/apk file please include that as well." +
"\nBytecode Viewer Version: " + VERSION +
", Preview Copy: " + PREVIEW_COPY +
", Fat Jar: " + FAT_JAR +
", OS: " + System.getProperty("os.name") +

View File

@ -18,6 +18,7 @@ import java.util.zip.ZipOutputStream;
import me.konloch.kontainer.io.DiskReader;
import org.objectweb.asm.tree.ClassNode;
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.util.MiscUtils;
@ -142,7 +143,8 @@ public class CFRDecompiler extends InternalDecompiler
if (file.exists())
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();
@ -171,15 +173,17 @@ public class CFRDecompiler extends InternalDecompiler
String exception =
"Bytecode Viewer Version: " + VERSION + nl + nl + sw;
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;
}
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) {

View File

@ -10,6 +10,7 @@ import org.apache.commons.lang3.ArrayUtils;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
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.util.MiscUtils;
@ -129,7 +130,7 @@ public class FernFlowerDecompiler extends InternalDecompiler
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 + exception;
}

View File

@ -11,6 +11,7 @@ import java.util.Objects;
import java.util.Random;
import me.konloch.kontainer.io.DiskReader;
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.util.MiscUtils;
@ -84,7 +85,7 @@ public class JADXDecompiler extends InternalDecompiler
if(exception.isEmpty())
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 + exception;
}
@ -114,9 +115,9 @@ public class JADXDecompiler extends InternalDecompiler
e.printStackTrace();
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"
+ ".com" + nl + nl + "Suggested Fix: Click refresh class, "
+ "if it fails again try another decompiler." + nl + nl + exception;
return "JADX error! " + ExceptionUI.SEND_STACKTRACE_TO +
nl + nl + "Suggested Fix: Click refresh class, " +
"if it fails again try another decompiler." + nl + nl + exception;
}
return s;
}

View File

@ -7,6 +7,7 @@ import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import the.bytecode.club.bytecodeviewer.api.ExceptionUI;
import the.bytecode.club.bytecodeviewer.decompilers.InternalDecompiler;
import the.bytecode.club.bytecodeviewer.decompilers.jdgui.DirectoryLoader;
import the.bytecode.club.bytecodeviewer.decompilers.jdgui.CommonPreferences;
@ -116,7 +117,7 @@ public class JDGUIDecompiler extends InternalDecompiler
"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 + exception;
}

View File

@ -32,6 +32,7 @@ import java.util.zip.ZipException;
import java.util.zip.ZipOutputStream;
import org.objectweb.asm.tree.ClassNode;
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.util.EncodeUtils;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
@ -129,7 +130,7 @@ public class ProcyonDecompiler extends InternalDecompiler
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 + exception;
}

View File

@ -9,6 +9,7 @@ import java.util.Objects;
import me.konloch.kontainer.io.DiskReader;
import org.apache.commons.io.FileUtils;
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.util.Dex2Jar;
import the.bytecode.club.bytecodeviewer.util.FileContainer;
@ -114,7 +115,7 @@ public class SmaliDisassembler extends InternalDecompiler
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 + exception;
}