#896: show exception in log frame, static final loggers added

This commit is contained in:
2015-05-22 11:29:27 +02:00
parent c8350b19bd
commit 39f35dec29
18 changed files with 116 additions and 86 deletions
@@ -50,6 +50,8 @@ import java.util.logging.Logger;
*/
public class ScriptPack extends AS3ClassTreeItem {
private static final Logger logger = Logger.getLogger(ScriptPack.class.getName());
public final ABC abc;
public final int scriptIndex;
@@ -174,12 +176,12 @@ public class ScriptPack extends AS3ClassTreeItem {
}, timeout, TimeUnit.SECONDS);
} catch (TimeoutException ex) {
writer.continueMeasure();
Logger.getLogger(ScriptPack.class.getName()).log(Level.SEVERE, "Decompilation error", ex);
logger.log(Level.SEVERE, "Decompilation error", ex);
Helper.appendTimeoutComment(writer, timeout);
return;
} catch (ExecutionException ex) {
writer.continueMeasure();
Logger.getLogger(ScriptPack.class.getName()).log(Level.SEVERE, "Decompilation error", ex);
logger.log(Level.SEVERE, "Decompilation error", ex);
Helper.appendErrorComment(writer, ex);
return;
}
@@ -205,10 +207,10 @@ public class ScriptPack extends AS3ClassTreeItem {
FileTextWriter writer2 = exportSettings.singleFile ? exportSettings.singleFileWriter : writer;
toSource(writer2, abc.script_info.get(scriptIndex).traits.traits, exportSettings.mode, parallel);
} catch (InterruptedException ex) {
Logger.getLogger(ScriptPack.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
} catch (FileNotFoundException ex) {
Logger.getLogger(ScriptPack.class.getName()).log(Level.SEVERE, "The file path is probably too long", ex);
logger.log(Level.SEVERE, "The file path is probably too long", ex);
}
return file;
@@ -50,6 +50,8 @@ import java.util.logging.Logger;
public final class MethodBody implements Cloneable {
private static final Logger logger = Logger.getLogger(MethodBody.class.getName());
@Internal
public boolean deleted;
@@ -113,7 +115,7 @@ public final class MethodBody implements Cloneable {
avm2Code = new AVM2Code(ais);
} catch (UnknownInstructionCode | IOException ex) {
avm2Code = new AVM2Code();
Logger.getLogger(MethodBody.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
avm2Code.compact();
code = avm2Code;
@@ -224,9 +226,9 @@ public final class MethodBody implements Cloneable {
throw ex;
} catch (Exception | OutOfMemoryError | StackOverflowError ex) {
if (ex instanceof TimeoutException) {
Logger.getLogger(MethodBody.class.getName()).log(Level.SEVERE, "Decompilation timeout in " + path, ex);
logger.log(Level.SEVERE, "Decompilation timeout in " + path, ex);
} else {
Logger.getLogger(MethodBody.class.getName()).log(Level.SEVERE, "Decompilation error in " + path, ex);
logger.log(Level.SEVERE, "Decompilation error in " + path, ex);
}
convertException = ex;
Throwable cause = ex.getCause();
@@ -278,7 +280,7 @@ public final class MethodBody implements Cloneable {
try {
deobfuscated.removeTraps(constants, trait, method_info.get(this.method_info), b, abc, scriptIndex, classIndex, isStatic, path);
} catch (StackOverflowError ex) {
Logger.getLogger(MethodBody.class.getName()).log(Level.SEVERE, "Error during remove traps in " + path, ex);
logger.log(Level.SEVERE, "Error during remove traps in " + path, ex);
}
}
//deobfuscated.restoreControlFlow(constants, b);