Cleanup On Decompiler Failure
This commit is contained in:
parent
b69389cc5f
commit
17e1d621fe
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user