mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-12 08:14:49 +00:00
#896: show exception in log frame, static final loggers added
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user