Cleaned Up Error Alerts

This commit is contained in:
Konloch 2021-07-11 09:52:07 -07:00
parent 7d09510194
commit 789ac13cd1
10 changed files with 47 additions and 48 deletions

View File

@ -42,6 +42,7 @@ public class ExceptionUI extends JFrame
{
public static final String KONLOCH = "https://github.com/Konloch/bytecode-viewer/issues or Konloch at https://the.bytcode.club or konloch@gmail.com";
public static final String SEND_STACKTRACE_TO = buildErrorLogHeader(KONLOCH);
public static final String SEND_STACKTRACE_TO_NL = SEND_STACKTRACE_TO + nl + nl;
/**
* @param e The exception to be shown

View File

@ -131,12 +131,10 @@ public class CFRDecompiler extends InternalDecompiler
try {
org.benf.cfr.reader.Main.main(generateMainMethod(tempClass.getAbsolutePath(), fuckery));
} catch (StackOverflowError | Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
StringWriter exceptionWriter = new StringWriter();
e.printStackTrace(new PrintWriter(exceptionWriter));
e.printStackTrace();
exception =
"Bytecode Viewer Version: " + VERSION + nl + nl + sw;
exception = exceptionWriter.toString();
}
tempClass.delete();
@ -170,15 +168,13 @@ public class CFRDecompiler extends InternalDecompiler
try {
s = DiskReader.loadAsString(f.getAbsolutePath());
} catch (Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
StringWriter exceptionWriter = new StringWriter();
e.printStackTrace(new PrintWriter(exceptionWriter));
e.printStackTrace();
String exception = "Bytecode Viewer Version: " + VERSION + nl + nl + sw;
return CFR + " " + ERROR + "! " + ExceptionUI.SEND_STACKTRACE_TO +
nl + nl + TranslatedStrings.SUGGESTED_FIX_DECOMPILER_ERROR +
nl + nl + exception;
nl + nl + exceptionWriter;
}
return s;

View File

@ -45,7 +45,6 @@ import static the.bytecode.club.bytecodeviewer.translation.TranslatedStrings.*;
*/
public class FernFlowerDecompiler extends InternalDecompiler
{
@Override
public void decompileToZip(String sourceJar, String zipName)
{
@ -78,10 +77,10 @@ public class FernFlowerDecompiler extends InternalDecompiler
fos.write(b);
fos.close();
} catch (final IOException e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
StringWriter exceptionWriter = new StringWriter();
e.printStackTrace(new PrintWriter(exceptionWriter));
e.printStackTrace();
exception = "Bytecode Viewer Version: " + VERSION + nl + nl + sw;
exception = exceptionWriter.toString();
}
@ -110,10 +109,10 @@ public class FernFlowerDecompiler extends InternalDecompiler
org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler.main(
generateMainMethod(tempClass.getAbsolutePath(), new File(tempDirectory).getAbsolutePath()));
} catch (Throwable e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
StringWriter exceptionWriter = new StringWriter();
e.printStackTrace(new PrintWriter(exceptionWriter));
e.printStackTrace();
exception = "Bytecode Viewer Version: " + VERSION + nl + nl + sw;
exception = exceptionWriter.toString();
}
}
@ -129,11 +128,11 @@ public class FernFlowerDecompiler extends InternalDecompiler
return s;
} catch (Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
StringWriter exceptionWriter = new StringWriter();
e.printStackTrace(new PrintWriter(exceptionWriter));
e.printStackTrace();
exception += nl + nl + sw;
exception += nl + nl + exceptionWriter;
}
}

View File

@ -45,6 +45,9 @@ import static the.bytecode.club.bytecodeviewer.translation.TranslatedStrings.*;
*/
public class JADXDecompiler extends InternalDecompiler
{
private Random r = new Random();
private File f;
@Override
public String decompileClassNode(ClassNode cn, byte[] b) {
String fileStart = tempDirectory + fs;
@ -74,10 +77,10 @@ public class JADXDecompiler extends InternalDecompiler
jadx.saveSources();
//jadx.close();
} catch (StackOverflowError | Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
StringWriter exceptionWriter = new StringWriter();
e.printStackTrace(new PrintWriter(exceptionWriter));
e.printStackTrace();
exception = "Bytecode Viewer Version: " + VERSION + nl + nl + sw;
exception = exceptionWriter.toString();
}
tempClass.delete();
@ -93,15 +96,18 @@ public class JADXDecompiler extends InternalDecompiler
nl + nl + exception;
}
Random r = new Random();
File f;
public String fuckery(String start) {
while (true) {
//TODO remove
public String fuckery(String start)
{
int failSafe = 0;
while (failSafe++ <= 42069)
{
f = new File(start + r.nextInt(Integer.MAX_VALUE));
if (!f.exists())
return f.toString();
}
return null;
}
public String findFile(File[] fA) {
@ -116,7 +122,7 @@ public class JADXDecompiler extends InternalDecompiler
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
String exception = "Bytecode Viewer Version: " + VERSION + nl + nl + sw;
String exception = ExceptionUI.SEND_STACKTRACE_TO_NL + sw;
return JADX + " " + ERROR + "! " + ExceptionUI.SEND_STACKTRACE_TO +
nl + nl + TranslatedStrings.SUGGESTED_FIX_DECOMPILER_ERROR +
@ -131,7 +137,5 @@ public class JADXDecompiler extends InternalDecompiler
}
@Override
public void decompileToZip(String sourceJar, String zipName) {
}
public void decompileToZip(String sourceJar, String zipName) { }
}

View File

@ -116,8 +116,7 @@ public class JDGUIDecompiler extends InternalDecompiler
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
exception =
"Bytecode Viewer Version: " + VERSION + nl + nl + sw;
exception = ExceptionUI.SEND_STACKTRACE_TO_NL + sw;
}
return JDGUI + " " + ERROR + "! " + ExceptionUI.SEND_STACKTRACE_TO +

View File

@ -21,6 +21,7 @@ import java.net.URLClassLoader;
import static the.bytecode.club.bytecodeviewer.Constants.fs;
import static the.bytecode.club.bytecodeviewer.api.ExceptionUI.KONLOCH;
import static the.bytecode.club.bytecodeviewer.api.ExceptionUI.SEND_STACKTRACE_TO;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
@ -96,7 +97,7 @@ public class JavapDisassembler extends InternalDecompiler
return sysOut.getTextAreaOutputStreamOut().getBuffer().toString();
}
return KONLOCH;
return SEND_STACKTRACE_TO;
}
@Override

View File

@ -14,6 +14,7 @@ import the.bytecode.club.bootloader.resource.ExternalResource;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Configuration;
import the.bytecode.club.bytecodeviewer.Constants;
import the.bytecode.club.bytecodeviewer.api.ExceptionUI;
import the.bytecode.club.bytecodeviewer.decompilers.InternalDecompiler;
import the.bytecode.club.bytecodeviewer.resources.ExternalResources;
import the.bytecode.club.bytecodeviewer.util.JarUtils;
@ -88,8 +89,7 @@ public class KrakatauDecompiler extends InternalDecompiler
return "Set your paths";
}
String s = "Bytecode Viewer Version: " + VERSION + nl + nl +
"Please send this to konloch@gmail.com. " + nl + nl;
String s = ExceptionUI.SEND_STACKTRACE_TO_NL;
BytecodeViewer.sm.pauseBlocking();
try {
@ -139,7 +139,7 @@ public class KrakatauDecompiler extends InternalDecompiler
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
s += nl + "Bytecode Viewer Version: " + VERSION + nl + nl + sw;
s += nl + ExceptionUI.SEND_STACKTRACE_TO_NL + sw;
} finally {
BytecodeViewer.sm.resumeBlocking();
}
@ -163,8 +163,7 @@ public class KrakatauDecompiler extends InternalDecompiler
return "Set your paths";
}
String s = "Bytecode Viewer Version: " + VERSION + nl + nl +
"Please send this to konloch@gmail.com. " + nl + nl;
String s = ExceptionUI.SEND_STACKTRACE_TO_NL;
final File tempDirectory = new File(Constants.tempDirectory + fs + MiscUtils.randomString(32) + fs);
tempDirectory.mkdir();
@ -224,7 +223,7 @@ public class KrakatauDecompiler extends InternalDecompiler
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
s += nl + "Bytecode Viewer Version: " + VERSION + nl + nl + sw;
s += nl + ExceptionUI.SEND_STACKTRACE_TO_NL + sw;
} finally {
BytecodeViewer.sm.resumeBlocking();
}

View File

@ -11,6 +11,7 @@ import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Configuration;
import the.bytecode.club.bytecodeviewer.Constants;
import the.bytecode.club.bytecodeviewer.api.ExceptionUI;
import the.bytecode.club.bytecodeviewer.decompilers.InternalDecompiler;
import the.bytecode.club.bytecodeviewer.resources.ExternalResources;
import the.bytecode.club.bytecodeviewer.util.JarUtils;
@ -50,8 +51,7 @@ public class KrakatauDisassembler extends InternalDecompiler
if(!ExternalResources.getSingleton().hasSetPythonCommand())
return "You need to set your Python 2.7 path!";
String s = "Bytecode Viewer Version: " + VERSION + nl + nl +
"Please send this to konloch@gmail.com. " + nl + nl;
String s = ExceptionUI.SEND_STACKTRACE_TO_NL;
final File tempDirectory = new File(Constants.tempDirectory + fs + MiscUtils.randomString(32) + fs);
tempDirectory.mkdir();
@ -104,7 +104,7 @@ public class KrakatauDisassembler extends InternalDecompiler
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
s += nl + "Bytecode Viewer Version: " + VERSION + nl + nl + sw;
s += nl + ExceptionUI.SEND_STACKTRACE_TO_NL + sw;
} finally {
BytecodeViewer.sm.resumeBlocking();
}

View File

@ -129,7 +129,7 @@ public class ProcyonDecompiler extends InternalDecompiler
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
exception = "Bytecode Viewer Version: " + VERSION + nl + nl + sw;
exception = ExceptionUI.SEND_STACKTRACE_TO_NL + sw;
}
return PROCYON + " " + ERROR + "! " + ExceptionUI.SEND_STACKTRACE_TO +

View File

@ -78,7 +78,7 @@ public class SmaliDisassembler extends InternalDecompiler
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
exception += "Bytecode Viewer Version: " + VERSION + nl + nl + sw;
exception += ExceptionUI.SEND_STACKTRACE_TO_NL + sw;
}
File rename = new File(tempDex.getName().replaceFirst("\\.dex", "-out"));
@ -90,7 +90,7 @@ public class SmaliDisassembler extends InternalDecompiler
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
exception += "Bytecode Viewer Version: " + VERSION + nl + nl + sw;
exception += ExceptionUI.SEND_STACKTRACE_TO_NL + sw;
}
File outputSmali = null;
@ -114,7 +114,7 @@ public class SmaliDisassembler extends InternalDecompiler
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
exception += "Bytecode Viewer Version: " + VERSION + nl + nl + sw;
exception += ExceptionUI.SEND_STACKTRACE_TO_NL + sw;
}
return SMALI + " " + DISASSEMBLER + " " + ERROR + "! " + ExceptionUI.SEND_STACKTRACE_TO +