small fixes, cleanup

This commit is contained in:
honfika@gmail.com
2014-09-01 21:06:01 +02:00
parent ed53ba9d0f
commit 278b9256d2
19 changed files with 954 additions and 940 deletions

View File

@@ -24,7 +24,7 @@ import java.util.ResourceBundle;
*/
public class AppResources {
private static final ResourceBundle resourceBundle = ResourceBundle.getBundle("com.jpexs.decompiler.flash.gui.locales.AppResources");
private static final ResourceBundle resourceBundle = ResourceBundle.getBundle("com.jpexs.decompiler.flash.locales.AppResources");
public static String translate(String key) {
return resourceBundle.getString(key);

View File

@@ -1185,6 +1185,31 @@ public final class SWF implements TreeItem, Timelined {
return ret;
}
public Map<String, ASMSource> getASMs() {
List<TreeNode> list = createASTagList(tags, this);
Map<String, ASMSource> asms = new HashMap<>();
getASMs("", list, asms);
return asms;
}
private static void getASMs(String path, List<TreeNode> nodes, Map<String, ASMSource> result) {
for (TreeNode n : nodes) {
String subPath = path + "/" + n.toString();
if (n.getItem() instanceof ASMSource) {
//cacheScript((ASMSource) n.tag);
String npath = subPath;
int ppos = 1;
while (result.containsKey(npath)) {
ppos++;
npath = subPath + "[" + ppos + "]";
}
result.put(npath, (ASMSource) n.getItem());
}
getASMs(subPath, n.subNodes, result);
}
}
public static void getTagsFromTreeNodes(List<TreeNode> treeNodes, List<Tag> result) {
for (TreeNode treeNode : treeNodes) {
TreeItem treeItem = treeNode.getItem();

View File

@@ -56,7 +56,7 @@ public class MethodBody implements Cloneable, Serializable {
public ABCException[] exceptions = new ABCException[0];
public Traits traits = new Traits();
public transient List<GraphTargetItem> convertedItems;
public transient Exception convertException;
public transient Throwable convertException;
public List<Integer> getExceptionEntries() {
List<Integer> ret = new ArrayList<>();
@@ -152,11 +152,12 @@ public class MethodBody implements Cloneable, Serializable {
}
} catch (InterruptedException ex) {
throw ex;
} catch (Exception ex) {
} catch (Exception | OutOfMemoryError | StackOverflowError ex) {
Logger.getLogger(MethodBody.class.getName()).log(Level.SEVERE, "Decompilation error", ex);
convertException = ex;
if (ex instanceof ExecutionException && ex.getCause() instanceof Exception) {
convertException = (Exception) ex.getCause();
Throwable cause = ex.getCause();
if (ex instanceof ExecutionException && cause instanceof Exception) {
convertException = (Exception) cause;
}
}
}

View File

@@ -693,11 +693,14 @@ public class Action implements GraphSourceItem {
return tree;
}
}, timeout, TimeUnit.SECONDS);
} catch (TimeoutException | ExecutionException | OutOfMemoryError | TranslateException | StackOverflowError ex) {
} catch (InterruptedException ex) {
throw ex;
} catch (Exception | OutOfMemoryError | StackOverflowError ex) {
Logger.getLogger(Action.class.getName()).log(Level.SEVERE, "Decompilation error in: " + path, ex);
convertException = ex;
if (ex instanceof ExecutionException && ex.getCause() instanceof Exception) {
convertException = (Exception) ex.getCause();
Throwable cause = ex.getCause();
if (ex instanceof ExecutionException && cause instanceof Exception) {
convertException = cause;
}
}
writer.continueMeasure();