Cleanup On Decompiler Failure

This commit is contained in:
Konloch 2024-10-02 12:12:43 -06:00
parent b69389cc5f
commit 17e1d621fe

AI 샘플 코드 생성 중입니다

Loading...

View File

@ -82,12 +82,13 @@ public class ProcyonDecompiler extends AbstractDecompiler
@Override
public String decompileClassNode(ClassNode cn, byte[] bytes)
{
TempFile tempFile = null;
String exception;
try
{
final TempFile tempFile = TempFile.createTemporaryFile(false, ".class");
final File tempClassFile = tempFile.getFile();
tempFile = TempFile.createTemporaryFile(false, ".class");
File tempClassFile = tempFile.getFile();
//write the ClassNode bytes to the temp file
try (FileOutputStream fos = new FileOutputStream(tempClassFile))
@ -128,6 +129,10 @@ public class ProcyonDecompiler extends AbstractDecompiler
exception = ExceptionUI.SEND_STACKTRACE_TO_NL + sw;
}
//delete all temporary files
if(tempFile != null)
tempFile.delete();
return PROCYON + " " + ERROR + "! " + ExceptionUI.SEND_STACKTRACE_TO + NL + NL
+ TranslatedStrings.SUGGESTED_FIX_DECOMPILER_ERROR + NL + NL + exception;
}