From 39f35dec29f8578b57ed35ef65dd2182d5c29e32 Mon Sep 17 00:00:00 2001 From: "honfika@gmail.com" Date: Fri, 22 May 2015 11:29:27 +0200 Subject: [PATCH] #896: show exception in log frame, static final loggers added --- .../decompiler/flash/abc/ScriptPack.java | 10 +++++---- .../flash/abc/types/MethodBody.java | 10 +++++---- .../flash/action/parser/pcode/ASMParser.java | 8 ++++--- .../exporters/script/AS2ScriptExporter.java | 2 +- .../flash/exporters/swf/SwfXmlExporter.java | 8 ++++--- .../flash/importers/SwfXmlImporter.java | 8 ++++--- .../decompiler/flash/xfl/XFLConverter.java | 21 +++++++++--------- .../src/com/jpexs/helpers/FileHashMap.java | 12 +++++----- .../com/jpexs/helpers/ReflectionTools.java | 20 +++++++++-------- .../console/CommandLineArgumentParser.java | 22 ++++++++++--------- .../decompiler/flash/gui/GenericTagPanel.java | 14 +++++++----- .../flash/gui/GenericTagTreePanel.java | 16 ++++++++------ .../decompiler/flash/gui/ImagePanel.java | 10 +++++---- src/com/jpexs/decompiler/flash/gui/Main.java | 4 ++-- .../jpexs/decompiler/flash/gui/TextPanel.java | 10 +++++---- .../decompiler/flash/gui/abc/ABCPanel.java | 5 ++--- .../flash/gui/action/ActionPanel.java | 12 ++++++---- .../flash/gui/dumpview/DumpTree.java | 10 +++++---- 18 files changed, 116 insertions(+), 86 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java index 7ec467459..4bf8ff906 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java @@ -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; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java index d453841d5..e01a14714 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java @@ -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); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java index c0cd69e43..94cde5bb0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/pcode/ASMParser.java @@ -138,6 +138,8 @@ import java.util.logging.Logger; public class ASMParser { + private static final Logger logger = Logger.getLogger(ASMParser.class.getName()); + public static ActionList parse(boolean ignoreNops, List