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 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 = buildErrorLogHeader(KONLOCH);
public static final String SEND_STACKTRACE_TO_NL = SEND_STACKTRACE_TO + nl + nl;
/** /**
* @param e The exception to be shown * @param e The exception to be shown

View file

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

View file

@ -45,7 +45,6 @@ import static the.bytecode.club.bytecodeviewer.translation.TranslatedStrings.*;
*/ */
public class FernFlowerDecompiler extends InternalDecompiler public class FernFlowerDecompiler extends InternalDecompiler
{ {
@Override @Override
public void decompileToZip(String sourceJar, String zipName) public void decompileToZip(String sourceJar, String zipName)
{ {
@ -78,10 +77,10 @@ public class FernFlowerDecompiler extends InternalDecompiler
fos.write(b); fos.write(b);
fos.close(); fos.close();
} catch (final IOException e) { } catch (final IOException e) {
StringWriter sw = new StringWriter(); StringWriter exceptionWriter = new StringWriter();
e.printStackTrace(new PrintWriter(sw)); e.printStackTrace(new PrintWriter(exceptionWriter));
e.printStackTrace(); 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( org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler.main(
generateMainMethod(tempClass.getAbsolutePath(), new File(tempDirectory).getAbsolutePath())); generateMainMethod(tempClass.getAbsolutePath(), new File(tempDirectory).getAbsolutePath()));
} catch (Throwable e) { } catch (Throwable e) {
StringWriter sw = new StringWriter(); StringWriter exceptionWriter = new StringWriter();
e.printStackTrace(new PrintWriter(sw)); e.printStackTrace(new PrintWriter(exceptionWriter));
e.printStackTrace(); e.printStackTrace();
exception = "Bytecode Viewer Version: " + VERSION + nl + nl + sw; exception = exceptionWriter.toString();
} }
} }
@ -129,11 +128,11 @@ public class FernFlowerDecompiler extends InternalDecompiler
return s; return s;
} catch (Exception e) { } catch (Exception e) {
StringWriter sw = new StringWriter(); StringWriter exceptionWriter = new StringWriter();
e.printStackTrace(new PrintWriter(sw)); e.printStackTrace(new PrintWriter(exceptionWriter));
e.printStackTrace(); 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 public class JADXDecompiler extends InternalDecompiler
{ {
private Random r = new Random();
private File f;
@Override @Override
public String decompileClassNode(ClassNode cn, byte[] b) { public String decompileClassNode(ClassNode cn, byte[] b) {
String fileStart = tempDirectory + fs; String fileStart = tempDirectory + fs;
@ -74,10 +77,10 @@ public class JADXDecompiler extends InternalDecompiler
jadx.saveSources(); jadx.saveSources();
//jadx.close(); //jadx.close();
} catch (StackOverflowError | Exception e) { } catch (StackOverflowError | Exception e) {
StringWriter sw = new StringWriter(); StringWriter exceptionWriter = new StringWriter();
e.printStackTrace(new PrintWriter(sw)); e.printStackTrace(new PrintWriter(exceptionWriter));
e.printStackTrace(); e.printStackTrace();
exception = "Bytecode Viewer Version: " + VERSION + nl + nl + sw; exception = exceptionWriter.toString();
} }
tempClass.delete(); tempClass.delete();
@ -93,15 +96,18 @@ public class JADXDecompiler extends InternalDecompiler
nl + nl + exception; nl + nl + exception;
} }
Random r = new Random(); //TODO remove
File f; public String fuckery(String start)
{
public String fuckery(String start) { int failSafe = 0;
while (true) { while (failSafe++ <= 42069)
{
f = new File(start + r.nextInt(Integer.MAX_VALUE)); f = new File(start + r.nextInt(Integer.MAX_VALUE));
if (!f.exists()) if (!f.exists())
return f.toString(); return f.toString();
} }
return null;
} }
public String findFile(File[] fA) { public String findFile(File[] fA) {
@ -116,7 +122,7 @@ public class JADXDecompiler extends InternalDecompiler
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw)); e.printStackTrace(new PrintWriter(sw));
e.printStackTrace(); 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 + return JADX + " " + ERROR + "! " + ExceptionUI.SEND_STACKTRACE_TO +
nl + nl + TranslatedStrings.SUGGESTED_FIX_DECOMPILER_ERROR + nl + nl + TranslatedStrings.SUGGESTED_FIX_DECOMPILER_ERROR +
@ -131,7 +137,5 @@ public class JADXDecompiler extends InternalDecompiler
} }
@Override @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(new PrintWriter(sw));
e.printStackTrace(); e.printStackTrace();
exception = exception = ExceptionUI.SEND_STACKTRACE_TO_NL + sw;
"Bytecode Viewer Version: " + VERSION + nl + nl + sw;
} }
return JDGUI + " " + ERROR + "! " + ExceptionUI.SEND_STACKTRACE_TO + 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.Constants.fs;
import static the.bytecode.club.bytecodeviewer.api.ExceptionUI.KONLOCH; 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 * * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
@ -96,7 +97,7 @@ public class JavapDisassembler extends InternalDecompiler
return sysOut.getTextAreaOutputStreamOut().getBuffer().toString(); return sysOut.getTextAreaOutputStreamOut().getBuffer().toString();
} }
return KONLOCH; return SEND_STACKTRACE_TO;
} }
@Override @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.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Configuration; import the.bytecode.club.bytecodeviewer.Configuration;
import the.bytecode.club.bytecodeviewer.Constants; 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.decompilers.InternalDecompiler;
import the.bytecode.club.bytecodeviewer.resources.ExternalResources; import the.bytecode.club.bytecodeviewer.resources.ExternalResources;
import the.bytecode.club.bytecodeviewer.util.JarUtils; import the.bytecode.club.bytecodeviewer.util.JarUtils;
@ -88,8 +89,7 @@ public class KrakatauDecompiler extends InternalDecompiler
return "Set your paths"; return "Set your paths";
} }
String s = "Bytecode Viewer Version: " + VERSION + nl + nl + String s = ExceptionUI.SEND_STACKTRACE_TO_NL;
"Please send this to konloch@gmail.com. " + nl + nl;
BytecodeViewer.sm.pauseBlocking(); BytecodeViewer.sm.pauseBlocking();
try { try {
@ -139,7 +139,7 @@ public class KrakatauDecompiler extends InternalDecompiler
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw)); e.printStackTrace(new PrintWriter(sw));
e.printStackTrace(); e.printStackTrace();
s += nl + "Bytecode Viewer Version: " + VERSION + nl + nl + sw; s += nl + ExceptionUI.SEND_STACKTRACE_TO_NL + sw;
} finally { } finally {
BytecodeViewer.sm.resumeBlocking(); BytecodeViewer.sm.resumeBlocking();
} }
@ -163,8 +163,7 @@ public class KrakatauDecompiler extends InternalDecompiler
return "Set your paths"; return "Set your paths";
} }
String s = "Bytecode Viewer Version: " + VERSION + nl + nl + String s = ExceptionUI.SEND_STACKTRACE_TO_NL;
"Please send this to konloch@gmail.com. " + nl + nl;
final File tempDirectory = new File(Constants.tempDirectory + fs + MiscUtils.randomString(32) + fs); final File tempDirectory = new File(Constants.tempDirectory + fs + MiscUtils.randomString(32) + fs);
tempDirectory.mkdir(); tempDirectory.mkdir();
@ -224,7 +223,7 @@ public class KrakatauDecompiler extends InternalDecompiler
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw)); e.printStackTrace(new PrintWriter(sw));
e.printStackTrace(); e.printStackTrace();
s += nl + "Bytecode Viewer Version: " + VERSION + nl + nl + sw; s += nl + ExceptionUI.SEND_STACKTRACE_TO_NL + sw;
} finally { } finally {
BytecodeViewer.sm.resumeBlocking(); 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.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Configuration; import the.bytecode.club.bytecodeviewer.Configuration;
import the.bytecode.club.bytecodeviewer.Constants; 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.decompilers.InternalDecompiler;
import the.bytecode.club.bytecodeviewer.resources.ExternalResources; import the.bytecode.club.bytecodeviewer.resources.ExternalResources;
import the.bytecode.club.bytecodeviewer.util.JarUtils; import the.bytecode.club.bytecodeviewer.util.JarUtils;
@ -50,8 +51,7 @@ public class KrakatauDisassembler extends InternalDecompiler
if(!ExternalResources.getSingleton().hasSetPythonCommand()) if(!ExternalResources.getSingleton().hasSetPythonCommand())
return "You need to set your Python 2.7 path!"; return "You need to set your Python 2.7 path!";
String s = "Bytecode Viewer Version: " + VERSION + nl + nl + String s = ExceptionUI.SEND_STACKTRACE_TO_NL;
"Please send this to konloch@gmail.com. " + nl + nl;
final File tempDirectory = new File(Constants.tempDirectory + fs + MiscUtils.randomString(32) + fs); final File tempDirectory = new File(Constants.tempDirectory + fs + MiscUtils.randomString(32) + fs);
tempDirectory.mkdir(); tempDirectory.mkdir();
@ -104,7 +104,7 @@ public class KrakatauDisassembler extends InternalDecompiler
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw)); e.printStackTrace(new PrintWriter(sw));
e.printStackTrace(); e.printStackTrace();
s += nl + "Bytecode Viewer Version: " + VERSION + nl + nl + sw; s += nl + ExceptionUI.SEND_STACKTRACE_TO_NL + sw;
} finally { } finally {
BytecodeViewer.sm.resumeBlocking(); BytecodeViewer.sm.resumeBlocking();
} }

View file

@ -129,7 +129,7 @@ public class ProcyonDecompiler extends InternalDecompiler
e.printStackTrace(new PrintWriter(sw)); e.printStackTrace(new PrintWriter(sw));
e.printStackTrace(); e.printStackTrace();
exception = "Bytecode Viewer Version: " + VERSION + nl + nl + sw; exception = ExceptionUI.SEND_STACKTRACE_TO_NL + sw;
} }
return PROCYON + " " + ERROR + "! " + ExceptionUI.SEND_STACKTRACE_TO + 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(new PrintWriter(sw));
e.printStackTrace(); 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")); 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(new PrintWriter(sw));
e.printStackTrace(); e.printStackTrace();
exception += "Bytecode Viewer Version: " + VERSION + nl + nl + sw; exception += ExceptionUI.SEND_STACKTRACE_TO_NL + sw;
} }
File outputSmali = null; File outputSmali = null;
@ -114,7 +114,7 @@ public class SmaliDisassembler extends InternalDecompiler
e.printStackTrace(new PrintWriter(sw)); e.printStackTrace(new PrintWriter(sw));
e.printStackTrace(); 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 + return SMALI + " " + DISASSEMBLER + " " + ERROR + "! " + ExceptionUI.SEND_STACKTRACE_TO +