Cleanup FernFlower Exceptions

This commit is contained in:
Konloch 2024-10-02 14:25:26 -06:00
parent ab2ce702d9
commit 8d947b6748

AI 샘플 코드 생성 중입니다

Loading...

View File

@ -24,6 +24,7 @@ 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.AbstractDecompiler; import the.bytecode.club.bytecodeviewer.decompilers.AbstractDecompiler;
import the.bytecode.club.bytecodeviewer.translation.TranslatedStrings; import the.bytecode.club.bytecodeviewer.translation.TranslatedStrings;
import the.bytecode.club.bytecodeviewer.util.ExceptionUtils;
import the.bytecode.club.bytecodeviewer.util.TempFile; import the.bytecode.club.bytecodeviewer.util.TempFile;
import java.io.*; import java.io.*;
@ -73,7 +74,7 @@ public class FernFlowerDecompiler extends AbstractDecompiler
public String decompileClassNode(ClassNode cn, byte[] bytes) public String decompileClassNode(ClassNode cn, byte[] bytes)
{ {
TempFile tempFile = null; TempFile tempFile = null;
String exception = "This decompiler didn't throw an exception - this is probably a BCV logical bug"; String exception;
try try
{ {
@ -129,15 +130,11 @@ public class FernFlowerDecompiler extends AbstractDecompiler
if (tempOutputJavaFile.exists()) if (tempOutputJavaFile.exists())
return DiskReader.loadAsString(tempOutputJavaFile.getAbsolutePath()); return DiskReader.loadAsString(tempOutputJavaFile.getAbsolutePath());
else else
exception = "BCV Error: " + tempOutputJavaFile.getAbsolutePath() + " does not exist."; exception = FERNFLOWER + " " + ERROR + "! " + tempOutputJavaFile.getAbsolutePath() + " does not exist.";
} }
catch (Throwable e) catch (Throwable e)
{ {
StringWriter exceptionWriter = new StringWriter(); exception = NL + NL + ExceptionUtils.exceptionToString(e);
e.printStackTrace(new PrintWriter(exceptionWriter));
e.printStackTrace();
exception += NL + NL + exceptionWriter;
} }
finally finally
{ {