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

This commit is contained in:
honfika@gmail.com
2015-05-22 11:29:27 +02:00
parent c8350b19bd
commit 39f35dec29
18 changed files with 116 additions and 86 deletions

View File

@@ -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;

View 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);

View File

@@ -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<Label> labels, Map<Action, Integer> lineMap, long address, FlasmLexer lexer, List<String> constantPool, int version) throws IOException, ActionParseException {
ActionList list = new ActionList();
Stack<GraphSourceItemContainer> containers = new Stack<>();
@@ -496,7 +498,7 @@ public class ASMParser {
throw new ActionParseException(message, line);
} else {
Logger.getLogger(ASMParser.class.getName()).log(Level.SEVERE, message);
logger.log(Level.SEVERE, message);
}
}
@@ -522,7 +524,7 @@ public class ASMParser {
throw new ActionParseException(message, line);
} else {
Logger.getLogger(ASMParser.class.getName()).log(Level.SEVERE, message);
logger.log(Level.SEVERE, message);
}
}
@@ -543,7 +545,7 @@ public class ASMParser {
throw new ActionParseException(message, line);
} else {
Logger.getLogger(ASMParser.class.getName()).log(Level.SEVERE, message);
logger.log(Level.SEVERE, message);
}
}
}

View File

@@ -158,7 +158,7 @@ public class AS2ScriptExporter {
return file;
} catch (InterruptedException ex) {
} catch (IOException | OutOfMemoryError | TranslateException | StackOverflowError ex) {
Logger.getLogger(AS2ScriptExporter.class.getName()).log(Level.SEVERE, "Decompilation error in script: " + name, ex);
logger.log(Level.SEVERE, "Decompilation error in script: " + name, ex);
if (handler != null) {
int action = handler.getNewInstance().handle(ex);
switch (action) {

View File

@@ -59,6 +59,8 @@ import org.w3c.dom.Node;
*/
public class SwfXmlExporter {
private static final Logger logger = Logger.getLogger(SwfXmlExporter.class.getName());
private final Map<Class, List<Field>> cachedFields = new HashMap<>();
public List<File> exportXml(SWF swf, File outFile) throws IOException {
@@ -71,7 +73,7 @@ public class SwfXmlExporter {
writer.append(getXml(xmlDoc));
}
} catch (ParserConfigurationException ex) {
Logger.getLogger(SwfXmlExporter.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
List<File> ret = new ArrayList<>();
@@ -90,7 +92,7 @@ public class SwfXmlExporter {
StreamResult result = new StreamResult(writer);
transformer.transform(source, result);
} catch (TransformerException ex) {
Logger.getLogger(SwfXmlExporter.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
return writer.toString();
}
@@ -192,7 +194,7 @@ public class SwfXmlExporter {
f.setAccessible(true);
generateXml(doc, objNode, f.getName(), f.get(obj), false, level + 1);
} catch (IllegalArgumentException | IllegalAccessException ex) {
Logger.getLogger(SwfXmlExporter.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
} else {

View File

@@ -125,6 +125,8 @@ import org.xml.sax.SAXException;
@SuppressWarnings("unchecked")
public class SwfXmlImporter {
private static final Logger logger = Logger.getLogger(SwfXmlImporter.class.getName());
private Map<String, Class> swfTags;
private Map<String, Class> swfObjects;
@@ -138,7 +140,7 @@ public class SwfXmlImporter {
Document doc = docBuilder.parse(new InputSource(new StringReader(xml)));
processElement(doc.getDocumentElement(), swf, swf, null);
} catch (ParserConfigurationException | SAXException ex) {
Logger.getLogger(SwfXmlImporter.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
@@ -165,7 +167,7 @@ public class SwfXmlImporter {
String attrValue = attr.getValue();
field.set(obj, getAs(field.getType(), attrValue));
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException ex) {
Logger.getLogger(SwfXmlImporter.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
}
@@ -212,7 +214,7 @@ public class SwfXmlImporter {
field.set(obj, childObj);
}
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException | NoSuchMethodException | InstantiationException | InvocationTargetException ex) {
Logger.getLogger(SwfXmlImporter.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
}

View File

@@ -148,6 +148,8 @@ import org.xml.sax.helpers.XMLReaderFactory;
*/
public class XFLConverter {
private static final Logger logger = Logger.getLogger(XFLConverter.class.getName());
public static final int KEY_MODE_NORMAL = 9728;
public static final int KEY_MODE_CLASSIC_TWEEN = 22017;
@@ -305,7 +307,7 @@ public class XFLConverter {
ret.append("bitmap").append(bitmapCh.getCharacterId()).append(".").append(it.getImageFormat());
} else {
if (bitmapCh != null) {
Logger.getLogger(XFLConverter.class.getName()).log(Level.SEVERE, "Suspicious bitmapfill:{0}", bitmapCh.getClass().getSimpleName());
logger.log(Level.SEVERE, "Suspicious bitmapfill:{0}", bitmapCh.getClass().getSimpleName());
}
ret.append("<SolidColor color=\"#ffffff\" />");
return;
@@ -1157,7 +1159,7 @@ public class XFLConverter {
try {
Action.actionsToSource(as, as.getActions(), as.toString(), writer);
} catch (InterruptedException ex) {
Logger.getLogger(XFLConverter.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
return writer.toString();
}
@@ -1429,7 +1431,7 @@ public class XFLConverter {
int adpcmCodeSize = (int) sis.readUB(2, "adpcmCodeSize");
bits = 2 + adpcmCodeSize;
} catch (IOException ex) {
Logger.getLogger(XFLConverter.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
if (soundFormat == SoundFormat.FORMAT_MP3) {
@@ -1485,7 +1487,7 @@ public class XFLConverter {
}
} catch (IOException ex) {
Logger.getLogger(XFLConverter.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
SoundTag st = (SoundTag) symbol;
@@ -1494,7 +1496,7 @@ public class XFLConverter {
try {
data = new SoundExporter().exportSound(st, SoundExportMode.MP3_WAV);
} catch (IOException ex) {
Logger.getLogger(XFLConverter.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
String symbolFile = "sound" + symbol.getCharacterId() + "." + exportFormat;
@@ -1547,7 +1549,7 @@ public class XFLConverter {
try {
data = new MovieExporter().exportMovie(video, MovieExportMode.FLV);
} catch (IOException ex) {
Logger.getLogger(XFLConverter.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
String symbolFile = "movie" + symbol.getCharacterId() + "." + "flv";
String mediaLinkStr = "";
@@ -1629,8 +1631,7 @@ public class XFLConverter {
transformer.transform(xmlInput, xmlOutput);
return xmlOutput.getWriter().toString();
} catch (TransformerFactoryConfigurationError | IllegalArgumentException | TransformerException e) {
System.err.println(input);
Logger.getLogger(XFLConverter.class.getName()).log(Level.SEVERE, "Pretty print error", e);
logger.log(Level.SEVERE, "Pretty print error", e);
return input;
}
}
@@ -2993,7 +2994,7 @@ public class XFLConverter {
ScriptExportSettings scriptExportSettings = new ScriptExportSettings(ScriptExportMode.AS, false);
swf.exportActionScript(handler, Path.combine(outDir.getAbsolutePath(), "scripts"), scriptExportSettings, parallel, null);
} catch (Exception ex) {
Logger.getLogger(XFLConverter.class.getName()).log(Level.SEVERE, "Error during ActionScript3 export", ex);
logger.log(Level.SEVERE, "Error during ActionScript3 export", ex);
}
}
}
@@ -3131,7 +3132,7 @@ public class XFLConverter {
System.err.println(tparser.result);
}
} catch (SAXException | IOException e) {
Logger.getLogger(XFLConverter.class.getName()).log(Level.SEVERE, "Error while converting HTML", e);
logger.log(Level.SEVERE, "Error while converting HTML", e);
}
return tparser.result;
}

View File

@@ -42,6 +42,8 @@ import java.util.logging.Logger;
*/
public class FileHashMap<K, V> extends AbstractMap<K, V> implements Freed {
private static final Logger logger = Logger.getLogger(FileHashMap.class.getName());
private final Map<K, Integer> lengths = new HashMap<>();
private final Map<K, Long> offsets = new HashMap<>();
@@ -167,11 +169,11 @@ public class FileHashMap<K, V> extends AbstractMap<K, V> implements Freed {
V ret = (V) ois.readObject();
return ret;
} catch (ClassNotFoundException ex) {
Logger.getLogger(FileHashMap.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
return null;
}
} catch (IOException ex) {
Logger.getLogger(FileHashMap.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
return null;
}
}
@@ -231,7 +233,7 @@ public class FileHashMap<K, V> extends AbstractMap<K, V> implements Freed {
fileLen += data.length;
}
} catch (IOException ex) {
Logger.getLogger(FileHashMap.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
} finally {
try {
oos.close();
@@ -291,7 +293,7 @@ public class FileHashMap<K, V> extends AbstractMap<K, V> implements Freed {
try {
file.setLength(0);
} catch (IOException ex) {
Logger.getLogger(FileHashMap.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
@@ -302,7 +304,7 @@ public class FileHashMap<K, V> extends AbstractMap<K, V> implements Freed {
try {
file.close();
} catch (IOException ex) {
Logger.getLogger(FileHashMap.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
fileName.delete();
deleted = true;

View File

@@ -33,6 +33,8 @@ import java.util.logging.Logger;
*/
public class ReflectionTools {
private static final Logger logger = Logger.getLogger(ReflectionTools.class.getName());
public static Object getValue(Object obj, Field field) throws IllegalArgumentException, IllegalAccessException {
Object value = field.get(obj);
return value;
@@ -135,7 +137,7 @@ public class ReflectionTools {
try {
arrValue = field.get(object);
} catch (IllegalArgumentException | IllegalAccessException ex) {
Logger.getLogger(ReflectionTools.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
return false;
}
Class componentClass = arrValue.getClass().getComponentType();
@@ -176,7 +178,7 @@ public class ReflectionTools {
try {
list = (List) field.get(object);
} catch (IllegalArgumentException | IllegalAccessException ex) {
Logger.getLogger(ReflectionTools.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
return false;
}
ParameterizedType listType = (ParameterizedType) field.getGenericType();
@@ -188,7 +190,7 @@ public class ReflectionTools {
}
list.add(index, val);
} catch (InstantiationException | IllegalAccessException ex) {
Logger.getLogger(ReflectionTools.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
return false;
}
return true;
@@ -219,7 +221,7 @@ public class ReflectionTools {
try {
arrValue = field.get(object);
} catch (IllegalArgumentException | IllegalAccessException ex) {
Logger.getLogger(ReflectionTools.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
return false;
}
Class componentClass = arrValue.getClass().getComponentType();
@@ -228,7 +230,7 @@ public class ReflectionTools {
try {
val = newInstanceOf(componentClass);
} catch (InstantiationException | IllegalAccessException ex) {
Logger.getLogger(ReflectionTools.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
return false;
}
if (val == null) {
@@ -253,7 +255,7 @@ public class ReflectionTools {
try {
field.set(object, copy);
} catch (IllegalArgumentException | IllegalAccessException ex) {
Logger.getLogger(ReflectionTools.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
return false;
}
return true;
@@ -286,7 +288,7 @@ public class ReflectionTools {
try {
list = (List) field.get(object);
} catch (IllegalArgumentException | IllegalAccessException ex) {
Logger.getLogger(ReflectionTools.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
return false;
}
if (index < 0 || index >= list.size()) {
@@ -301,7 +303,7 @@ public class ReflectionTools {
try {
arrValue = field.get(object);
} catch (IllegalArgumentException | IllegalAccessException ex) {
Logger.getLogger(ReflectionTools.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
return false;
}
Class componentClass = arrValue.getClass().getComponentType();
@@ -321,7 +323,7 @@ public class ReflectionTools {
try {
field.set(object, copy);
} catch (IllegalArgumentException | IllegalAccessException ex) {
Logger.getLogger(ReflectionTools.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
return false;
}
return true;

View File

@@ -127,6 +127,8 @@ import java.util.logging.Logger;
*/
public class CommandLineArgumentParser {
private static final Logger logger = Logger.getLogger(CommandLineArgumentParser.class.getName());
private static boolean commandLineMode = false;
private static String stdOut = null;
@@ -827,7 +829,7 @@ public class CommandLineArgumentParser {
swf.swfList = new SWFList();
swf.swfList.sourceInfo = sourceInfo;
} catch (IOException | InterruptedException ex) {
Logger.getLogger(CommandLineArgumentParser.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
break;
@@ -1141,7 +1143,7 @@ public class CommandLineArgumentParser {
}
} catch (OutOfMemoryError | Exception ex) {
System.err.print("FAIL: Exporting Failed on Exception - ");
Logger.getLogger(CommandLineArgumentParser.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
System.exit(1);
}
@@ -1174,7 +1176,7 @@ public class CommandLineArgumentParser {
System.err.println("File not found.");
}
} catch (IOException ex) {
Logger.getLogger(CommandLineArgumentParser.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
System.exit(0);
@@ -1199,7 +1201,7 @@ public class CommandLineArgumentParser {
System.err.println("File not found.");
}
} catch (IOException ex) {
Logger.getLogger(CommandLineArgumentParser.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
System.exit(0);
@@ -1217,10 +1219,10 @@ public class CommandLineArgumentParser {
} catch (FileNotFoundException ex) {
System.err.println("File not found.");
} catch (InterruptedException ex) {
Logger.getLogger(CommandLineArgumentParser.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
} catch (IOException ex) {
Logger.getLogger(CommandLineArgumentParser.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
System.exit(0);
@@ -1239,7 +1241,7 @@ public class CommandLineArgumentParser {
swf.saveTo(new BufferedOutputStream(fos));
}
} catch (IOException ex) {
Logger.getLogger(CommandLineArgumentParser.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
System.exit(0);
@@ -1325,7 +1327,7 @@ public class CommandLineArgumentParser {
}
}
} catch (IOException ex) {
Logger.getLogger(CommandLineArgumentParser.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
System.exit(0);
@@ -1365,7 +1367,7 @@ public class CommandLineArgumentParser {
System.err.println("File not found.");
}
} catch (IOException ex) {
Logger.getLogger(CommandLineArgumentParser.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
System.exit(0);
@@ -1694,7 +1696,7 @@ public class CommandLineArgumentParser {
SWFSourceInfo sourceInfo = new SWFSourceInfo(null, args.pop(), null);
Main.parseSWF(sourceInfo);
} catch (Exception ex) {
Logger.getLogger(CommandLineArgumentParser.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
System.exit(1);
}
System.exit(0);

View File

@@ -68,6 +68,8 @@ import javax.swing.SpringLayout;
*/
public class GenericTagPanel extends JPanel implements ChangeListener {
private static final Logger logger = Logger.getLogger(GenericTagPanel.class.getName());
private final JEditorPane genericTagPropertiesEditorPane;
private final JPanel genericTagPropertiesEditPanel;
@@ -270,7 +272,7 @@ public class GenericTagPanel extends JPanel implements ChangeListener {
addButtons.put(name, addButton);
}
} catch (IllegalArgumentException | IllegalAccessException ex) {
Logger.getLogger(GenericTagPanel.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
return propCount;
@@ -311,7 +313,7 @@ public class GenericTagPanel extends JPanel implements ChangeListener {
try {
Thread.sleep(500);
} catch (InterruptedException ex) {
Logger.getLogger(GenericTagPanel.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
View.execInEventDispatch(() -> {
@@ -358,7 +360,7 @@ public class GenericTagPanel extends JPanel implements ChangeListener {
try {
Thread.sleep(500);
} catch (InterruptedException ex) {
Logger.getLogger(GenericTagPanel.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
View.execInEventDispatch(() -> {
@@ -411,7 +413,7 @@ public class GenericTagPanel extends JPanel implements ChangeListener {
value = ReflectionTools.newInstanceOf(field.getType());
field.set(obj, value);
} catch (InstantiationException | IllegalAccessException ex) {
Logger.getLogger(GenericTagPanel.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
return 0;
}
} else {
@@ -480,7 +482,7 @@ public class GenericTagPanel extends JPanel implements ChangeListener {
try {
f.set(t, f.get(assigned));
} catch (IllegalArgumentException | IllegalAccessException ex) {
Logger.getLogger(GenericTagPanel.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
}
@@ -553,7 +555,7 @@ public class GenericTagPanel extends JPanel implements ChangeListener {
dependentLabel.setVisible(conditionMet);
dependentTypeLabel.setVisible(conditionMet);
} catch (AnnotationParseException ex) {
Logger.getLogger(GenericTagPanel.class.getName()).log(Level.SEVERE, "Invalid condition", ex);
logger.log(Level.SEVERE, "Invalid condition", ex);
}
}
if (!conditionMet) {

View File

@@ -83,6 +83,8 @@ import javax.swing.tree.TreePath;
*/
public class GenericTagTreePanel extends GenericTagPanel {
private static final Logger logger = Logger.getLogger(GenericTagTreePanel.class.getName());
private JTree tree;
private Tag editedTag;
@@ -132,7 +134,7 @@ public class GenericTagTreePanel extends GenericTagPanel {
try {
type = ReflectionTools.getValue(obj, field, index).getClass();
} catch (IllegalArgumentException | IllegalAccessException ex) {
Logger.getLogger(GenericTagTreePanel.class.getName()).log(Level.SEVERE, "Fixing characters order failed, recursion detected.");
logger.log(Level.SEVERE, "Fixing characters order failed, recursion detected.");
return null;
}
SWFType swfType = field.getAnnotation(SWFType.class);
@@ -368,7 +370,7 @@ public class GenericTagTreePanel extends GenericTagPanel {
ReflectionTools.setValue(obj, field, Array.newInstance(field.getType().getComponentType(), 0));
}
} catch (IllegalArgumentException | IllegalAccessException ex) {
Logger.getLogger(GenericTagTreePanel.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
}
@@ -445,7 +447,7 @@ public class GenericTagTreePanel extends GenericTagPanel {
val = ReflectionTools.newInstanceOf(field.getType());
ReflectionTools.setValue(obj, field, index, val);
} catch (InstantiationException | IllegalAccessException ex) {
Logger.getLogger(GenericTagTreePanel.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
return null;
}
}
@@ -532,7 +534,7 @@ public class GenericTagTreePanel extends GenericTagPanel {
}
}
} catch (AnnotationParseException ex) {
Logger.getLogger(GenericTagTreePanel.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
}
@@ -667,7 +669,7 @@ public class GenericTagTreePanel extends GenericTagPanel {
editedTag = tag.cloneTag();
} catch (InterruptedException ex) {
} catch (IOException ex) {
Logger.getLogger(GenericTagTreePanel.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
tree.setEditable(edit);
if (!edit) {
@@ -693,7 +695,7 @@ public class GenericTagTreePanel extends GenericTagPanel {
try {
f.set(t, f.get(assigned));
} catch (IllegalArgumentException | IllegalAccessException ex) {
Logger.getLogger(GenericTagTreePanel.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
}
@@ -811,7 +813,7 @@ public class GenericTagTreePanel extends GenericTagPanel {
continue;
}
} catch (AnnotationParseException | IllegalArgumentException | IllegalAccessException ex) {
Logger.getLogger(GenericTagTreePanel.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
}

View File

@@ -70,6 +70,8 @@ import javax.swing.JPanel;
public final class ImagePanel extends JPanel implements MediaDisplay {
private static final Logger logger = Logger.getLogger(ImagePanel.class.getName());
private final List<MediaDisplayListener> listeners = new ArrayList<>();
private Timelined timelined;
@@ -516,7 +518,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
try {
setImage(new SerializableImage(ImageIO.read(new ByteArrayInputStream(data))));
} catch (IOException ex) {
Logger.getLogger(ImagePanel.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
@@ -561,7 +563,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
try {
delayObject.wait(drawWaitLimit);
} catch (InterruptedException ex) {
Logger.getLogger(ImagePanel.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
@@ -900,7 +902,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
}
}
} catch (LineUnavailableException | IOException | UnsupportedAudioFileException ex) {
Logger.getLogger(ImagePanel.class.getName()).log(Level.SEVERE, "Error during playing sound", ex);
logger.log(Level.SEVERE, "Error during playing sound", ex);
}
}
@@ -989,7 +991,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
nextFrame(thisTimer);
}
} catch (Exception ex) {
Logger.getLogger(ImagePanel.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
};

View File

@@ -289,7 +289,7 @@ public class Main {
try {
result.add(worker.get());
} catch (CancellationException ex) {
Logger.getLogger(Main.class.getName()).log(Level.WARNING, "Loading SWF {0} was cancelled.", streamEntry.getKey());
logger.log(Level.WARNING, "Loading SWF {0} was cancelled.", streamEntry.getKey());
}
}
} else {
@@ -314,7 +314,7 @@ public class Main {
try {
result.add(worker.get());
} catch (CancellationException ex) {
Logger.getLogger(Main.class.getName()).log(Level.WARNING, "Loading SWF {0} was cancelled.", sourceInfo.getFileTitleOrName());
logger.log(Level.WARNING, "Loading SWF {0} was cancelled.", sourceInfo.getFileTitleOrName());
}
}

View File

@@ -51,6 +51,8 @@ import javax.swing.text.BadLocationException;
*/
public class TextPanel extends JPanel implements TagEditorPanel {
private static final Logger logger = Logger.getLogger(TextPanel.class.getName());
private final MainPanel mainPanel;
private final SearchPanel<TextTag> textSearchPanel;
@@ -220,7 +222,7 @@ public class TextPanel extends JPanel implements TagEditorPanel {
break;
}
} catch (BadLocationException ex) {
Logger.getLogger(TextPanel.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
}
@@ -244,7 +246,7 @@ public class TextPanel extends JPanel implements TagEditorPanel {
selected.replace(start - selStart, end - selStart, str);
} catch (BadLocationException ex) {
Logger.getLogger(TextPanel.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
}
@@ -344,7 +346,7 @@ public class TextPanel extends JPanel implements TagEditorPanel {
try {
textTag.undo();
} catch (InterruptedException | IOException ex) {
Logger.getLogger(TextPanel.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
textTag.getSwf().clearImageCache();
@@ -393,7 +395,7 @@ public class TextPanel extends JPanel implements TagEditorPanel {
saveText(false);
updateButtonsVisibility();
} catch (Exception ex) {
Logger.getLogger(TextPanel.class.getName()).log(Level.SEVERE, "Cannot auto-save text tag.", ex);
logger.log(Level.SEVERE, "Cannot auto-save text tag.", ex);
}
}

View File

@@ -83,7 +83,6 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
@@ -779,8 +778,8 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<ABC
decompiledTextArea.gotoLine((int) ex.line);
decompiledTextArea.markError();
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
} catch (IOException | InterruptedException ex) {
//ignore
} catch (Throwable ex) {
Logger.getLogger(ABCPanel.class.getName()).log(Level.SEVERE, null, ex);
}
}

View File

@@ -91,6 +91,8 @@ import jsyntaxpane.actions.ActionUtils;
public class ActionPanel extends JPanel implements SearchListener<ActionSearchResult>, TagEditorPanel {
private static final Logger logger = Logger.getLogger(ActionPanel.class.getName());
private MainPanel mainPanel;
public LineMarkedEditorPane editor;
@@ -327,7 +329,7 @@ public class ActionPanel extends JPanel implements SearchListener<ActionSearchRe
try {
asm.getASMSource(exportMode, writer, lastCode);
} catch (InterruptedException ex) {
Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
asm.removeDisassemblyListener(listener);
return new HighlightedText(writer);
@@ -749,7 +751,7 @@ public class ActionPanel extends JPanel implements SearchListener<ActionSearchRe
GraphDialog gf = new GraphDialog(mainPanel.getMainFrame().getWindow(), new ActionGraph(lastCode, new HashMap<>(), new HashMap<>(), new HashMap<>(), SWF.DEFAULT_VERSION), "");
gf.setVisible(true);
} catch (InterruptedException ex) {
Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
}
@@ -834,7 +836,7 @@ public class ActionPanel extends JPanel implements SearchListener<ActionSearchRe
src.setActions(actions);
} catch (InterruptedException ex) {
Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
@@ -858,11 +860,13 @@ public class ActionPanel extends JPanel implements SearchListener<ActionSearchRe
View.showMessageDialog(this, AppStrings.translate("message.action.saved"), AppStrings.translate("dialog.message.title"), JOptionPane.INFORMATION_MESSAGE, Configuration.showCodeSavedMessage);
setDecompiledEditMode(false);
} catch (IOException ex) {
Logger.getLogger(ActionPanel.class.getName()).log(Level.SEVERE, "IOException during action compiling", ex);
logger.log(Level.SEVERE, "IOException during action compiling", ex);
} catch (ActionParseException ex) {
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
} catch (CompilationException ex) {
View.showMessageDialog(this, AppStrings.translate("error.action.save").replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)), AppStrings.translate("error"), JOptionPane.ERROR_MESSAGE);
} catch (Throwable ex) {
logger.log(Level.SEVERE, null, ex);
}
}

View File

@@ -61,6 +61,8 @@ import javax.swing.tree.TreePath;
*/
public class DumpTree extends JTree {
private static final Logger logger = Logger.getLogger(DumpTree.class.getName());
private final MainPanel mainPanel;
public class DumpTreeCellRenderer extends DefaultTreeCellRenderer {
@@ -193,7 +195,7 @@ public class DumpTree extends JTree {
byte[] data = DumpInfoSwfNode.getSwfNode(dumpInfo).getSwf().originalUncompressedData;
fos.write(data, (int) dumpInfo.startByte, (int) (dumpInfo.getEndByte() - dumpInfo.startByte + 1));
} catch (IOException ex) {
Logger.getLogger(DumpTree.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
}
@@ -220,7 +222,7 @@ public class DumpTree extends JTree {
}
repaint();
} catch (IOException | InterruptedException ex) {
Logger.getLogger(DumpTree.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
}
@@ -236,7 +238,7 @@ public class DumpTree extends JTree {
ais.dumpInfo = dumpInfo;
new ABC(ais, swf, null);
} catch (IOException ex) {
Logger.getLogger(DumpTree.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
repaint();
}
@@ -253,7 +255,7 @@ public class DumpTree extends JTree {
ais.dumpInfo = dumpInfo;
new AVM2Code(ais);
} catch (IOException ex) {
Logger.getLogger(DumpTree.class.getName()).log(Level.SEVERE, null, ex);
logger.log(Level.SEVERE, null, ex);
}
repaint();
}