diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/RetryTask.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/RetryTask.java index 11d1d86e7..7877e387d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/RetryTask.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/RetryTask.java @@ -35,7 +35,7 @@ public class RetryTask { this.handler = handler; } - public void run() throws IOException { + public void run() throws IOException, InterruptedException { boolean retry; do { retry = false; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/RunnableIOEx.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/RunnableIOEx.java index bcb22ffbf..5da8a427b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/RunnableIOEx.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/RunnableIOEx.java @@ -25,5 +25,5 @@ import java.io.IOException; @FunctionalInterface public interface RunnableIOEx { - public void run() throws IOException; + public void run() throws IOException, InterruptedException; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java index b60b6b01e..1c5ac2384 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -1238,9 +1238,7 @@ public final class SWF implements SWFContainerItem, Timelined { swf.assignClassesToSymbols(); System.out.println(cnt + " identifiers renamed."); swf.saveTo(fos); - } catch (InterruptedException ex) { - return false; - } catch (IOException ex) { + } catch (InterruptedException | IOException ex) { return false; } return true; @@ -2129,12 +2127,12 @@ public final class SWF implements SWFContainerItem, Timelined { return ret; } - public void exportFla(AbortRetryIgnoreHandler handler, String outfile, String swfName, String generator, String generatorVerName, String generatorVersion, boolean parallel, FLAVersion version) throws IOException { + public void exportFla(AbortRetryIgnoreHandler handler, String outfile, String swfName, String generator, String generatorVerName, String generatorVersion, boolean parallel, FLAVersion version) throws IOException, InterruptedException { XFLConverter.convertSWF(handler, this, swfName, outfile, true, generator, generatorVerName, generatorVersion, parallel, version); clearAllCache(); } - public void exportXfl(AbortRetryIgnoreHandler handler, String outfile, String swfName, String generator, String generatorVerName, String generatorVersion, boolean parallel, FLAVersion version) throws IOException { + public void exportXfl(AbortRetryIgnoreHandler handler, String outfile, String swfName, String generator, String generatorVerName, String generatorVersion, boolean parallel, FLAVersion version) throws IOException, InterruptedException { XFLConverter.convertSWF(handler, this, swfName, outfile, false, generator, generatorVerName, generatorVersion, parallel, version); clearAllCache(); } 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 79a1c6532..fc92a3e37 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 @@ -204,7 +204,7 @@ public class ScriptPack extends AS3ClassTreeItem { appendTo(writer, traits, exportMode, parallel); } - public File export(String directory, ScriptExportSettings exportSettings, boolean parallel) throws IOException { + public File export(String directory, ScriptExportSettings exportSettings, boolean parallel) throws IOException, InterruptedException { File file = null; if (!exportSettings.singleFile) { @@ -212,12 +212,8 @@ public class ScriptPack extends AS3ClassTreeItem { } try (FileTextWriter writer = exportSettings.singleFile ? null : new FileTextWriter(Configuration.getCodeFormatting(), new FileOutputStream(file))) { - try { - FileTextWriter writer2 = exportSettings.singleFile ? exportSettings.singleFileWriter : writer; - toSource(writer2, abc.script_info.get(scriptIndex).traits.traits, exportSettings.mode, parallel); - } catch (InterruptedException ex) { - logger.log(Level.SEVERE, null, ex); - } + FileTextWriter writer2 = exportSettings.singleFile ? exportSettings.singleFileWriter : writer; + toSource(writer2, abc.script_info.get(scriptIndex).traits.traits, exportSettings.mode, parallel); } catch (FileNotFoundException ex) { logger.log(Level.SEVERE, "The file path is probably too long", ex); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java index 5a88af4f0..efbccf4a0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java @@ -1355,25 +1355,21 @@ public class AVM2Code implements Cloneable { private Map> killedRegs = new HashMap<>(); - public void calcKilledStats(MethodBody body) { + public void calcKilledStats(MethodBody body) throws InterruptedException { killedRegs.clear(); - try { - HashMap> vis = visitCode(body); - for (int k = 0; k < code.size(); k++) { - if (vis.get(k).isEmpty()) { - continue; - } - if (code.get(k).definition instanceof KillIns) { - int regid = code.get(k).operands[0]; - if (!killedRegs.containsKey(regid)) { - killedRegs.put(regid, new HashSet<>()); - } - killedRegs.get(regid).add(k); - } - } + HashMap> vis = visitCode(body); - } catch (InterruptedException ex) { - // ignored + for (int k = 0; k < code.size(); k++) { + if (vis.get(k).isEmpty()) { + continue; + } + if (code.get(k).definition instanceof KillIns) { + int regid = code.get(k).operands[0]; + if (!killedRegs.containsKey(regid)) { + killedRegs.put(regid, new HashSet<>()); + } + killedRegs.get(regid).add(k); + } } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorRegisters.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorRegisters.java index c41906a9e..663365335 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorRegisters.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorRegisters.java @@ -153,7 +153,7 @@ public class AVM2DeobfuscatorRegisters extends AVM2DeobfuscatorSimple { } } - private int getFirstRegisterSetter(Reference assignment, int classIndex, boolean isStatic, int scriptIndex, ABC abc, AVM2ConstantPool cpool, Trait trait, MethodInfo minfo, MethodBody body, Set ignoredRegisters, Set ignoredGets) { + private int getFirstRegisterSetter(Reference assignment, int classIndex, boolean isStatic, int scriptIndex, ABC abc, AVM2ConstantPool cpool, Trait trait, MethodInfo minfo, MethodBody body, Set ignoredRegisters, Set ignoredGets) throws InterruptedException { AVM2Code code = body.getCode(); Map ret = new HashMap<>(); @@ -165,7 +165,7 @@ public class AVM2DeobfuscatorRegisters extends AVM2DeobfuscatorSimple { return visitCode(assignment, new HashSet<>(), new TranslateStack("deo"), classIndex, isStatic, body, scriptIndex, abc, code, 0, code.code.size() - 1, res, ignoredRegisters, ignoredGets); } - private int visitCode(Reference assignment, Set visited, TranslateStack stack, int classIndex, boolean isStatic, MethodBody body, int scriptIndex, ABC abc, AVM2Code code, int idx, int endIdx, ExecutionResult result, Set ignored, Set ignoredGets) { + private int visitCode(Reference assignment, Set visited, TranslateStack stack, int classIndex, boolean isStatic, MethodBody body, int scriptIndex, ABC abc, AVM2Code code, int idx, int endIdx, ExecutionResult result, Set ignored, Set ignoredGets) throws InterruptedException { List output = new ArrayList<>(); AVM2LocalData localData = newLocalData(scriptIndex, abc, abc.constants, body, isStatic, classIndex); localData.localRegs.put(0, new NullAVM2Item(null));//this @@ -193,7 +193,7 @@ public class AVM2DeobfuscatorRegisters extends AVM2DeobfuscatorSimple { action.translate(localData, stack, output, Graph.SOP_USE_STATIC, ""); - //if (!(def instanceof KillIns)) + //if (!(def instanceof KillIns)) if (def instanceof SetLocalTypeIns) { int regId = ((SetLocalTypeIns) def).getRegisterId(action); if (!ignored.contains(regId)) { @@ -295,6 +295,8 @@ public class AVM2DeobfuscatorRegisters extends AVM2DeobfuscatorSimple { break; } } + } catch (InterruptedException ex) { + throw ex; } catch (Exception ex) { //ignore } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimple.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimple.java index 4202d4107..8904bf99a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimple.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimple.java @@ -224,7 +224,7 @@ public class AVM2DeobfuscatorSimple implements SWFDecompilerListener { return localData; } - private void executeActions(Map staticRegs, int classIndex, boolean isStatic, MethodBody body, int scriptIndex, ABC abc, AVM2Code code, int idx, int endIdx, ExecutionResult result, List inlineIns) { + private void executeActions(Map staticRegs, int classIndex, boolean isStatic, MethodBody body, int scriptIndex, ABC abc, AVM2Code code, int idx, int endIdx, ExecutionResult result, List inlineIns) throws InterruptedException { List output = new ArrayList<>(); AVM2LocalData localData = newLocalData(scriptIndex, abc, abc.constants, body, isStatic, classIndex); @@ -393,6 +393,8 @@ public class AVM2DeobfuscatorSimple implements SWFDecompilerListener { break; } } + } catch (InterruptedException ex) { + throw ex; } catch (Exception ex) { //ignore } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/deobfuscation/ActionDeobfuscator.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/deobfuscation/ActionDeobfuscator.java index 35fea0962..3d560a003 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/deobfuscation/ActionDeobfuscator.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/deobfuscation/ActionDeobfuscator.java @@ -83,7 +83,7 @@ public class ActionDeobfuscator extends ActionDeobfuscatorSimple { private final int executionLimit = 30000; @Override - public void actionListParsed(ActionList actions, SWF swf) { + public void actionListParsed(ActionList actions, SWF swf) throws InterruptedException { combinePushs(actions); Map fakeFunctions = getFakeFunctionResults(actions); removeUnreachableActions(actions); @@ -117,19 +117,19 @@ public class ActionDeobfuscator extends ActionDeobfuscatorSimple { } } - private boolean rereadActionList(ActionList actions, SWF swf) { + private boolean rereadActionList(ActionList actions, SWF swf) throws InterruptedException { byte[] actionBytes = Action.actionsToBytes(actions, true, SWF.DEFAULT_VERSION); try { SWFInputStream rri = new SWFInputStream(swf, actionBytes); ActionList newActions = ActionListReader.readActionList(new ArrayList<>(), rri, SWF.DEFAULT_VERSION, 0, actionBytes.length, "", -1); actions.setActions(newActions); - } catch (IOException | InterruptedException ex) { + } catch (IOException ex) { Logger.getLogger(ActionDeobfuscator.class.getName()).log(Level.SEVERE, null, ex); } return true; } - private boolean removeObfuscationIfs(ActionList actions, Map fakeFunctions) { + private boolean removeObfuscationIfs(ActionList actions, Map fakeFunctions) throws InterruptedException { if (actions.size() == 0) { return false; } @@ -227,7 +227,7 @@ public class ActionDeobfuscator extends ActionDeobfuscatorSimple { return cPool; } - private void executeActions(ActionList actions, int idx, int endIdx, ActionConstantPool constantPool, ExecutionResult result, Map fakeFunctions) { + private void executeActions(ActionList actions, int idx, int endIdx, ActionConstantPool constantPool, ExecutionResult result, Map fakeFunctions) throws InterruptedException { List output = new ArrayList<>(); ActionLocalData localData = new ActionLocalData(); FixItemCounterTranslateStack stack = new FixItemCounterTranslateStack(""); @@ -384,11 +384,11 @@ public class ActionDeobfuscator extends ActionDeobfuscatorSimple { break; } } - } catch (EmptyStackException | TranslateException | InterruptedException ex) { + } catch (EmptyStackException | TranslateException ex) { } } - private Map getFakeFunctionResults(ActionList actions) { + private Map getFakeFunctionResults(ActionList actions) throws InterruptedException { /* DefineFunction "fakeName" 0 { Push 1777 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/deobfuscation/ActionDeobfuscatorSimple.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/deobfuscation/ActionDeobfuscatorSimple.java index 6b90466f7..b6192f7ea 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/deobfuscation/ActionDeobfuscatorSimple.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/deobfuscation/ActionDeobfuscatorSimple.java @@ -67,7 +67,7 @@ public class ActionDeobfuscatorSimple implements SWFDecompilerListener { private final int executionLimit = 30000; @Override - public void actionListParsed(ActionList actions, SWF swf) { + public void actionListParsed(ActionList actions, SWF swf) throws InterruptedException { removeGetTimes(actions); removeObfuscationIfs(actions); } @@ -125,7 +125,7 @@ public class ActionDeobfuscatorSimple implements SWFDecompilerListener { return false; } - private boolean removeObfuscationIfs(ActionList actions) { + private boolean removeObfuscationIfs(ActionList actions) throws InterruptedException { if (actions.size() == 0) { return false; } @@ -270,7 +270,7 @@ public class ActionDeobfuscatorSimple implements SWFDecompilerListener { return result; } - private void executeActions(ActionList actions, int idx, int endIdx, ExecutionResult result) { + private void executeActions(ActionList actions, int idx, int endIdx, ExecutionResult result) throws InterruptedException { List output = new ArrayList<>(); ActionLocalData localData = new ActionLocalData(); FixItemCounterTranslateStack stack = new FixItemCounterTranslateStack(""); @@ -361,7 +361,7 @@ public class ActionDeobfuscatorSimple implements SWFDecompilerListener { result.stack.addAll(stack); } } - } catch (EmptyStackException | TranslateException | InterruptedException ex) { + } catch (EmptyStackException | TranslateException ex) { } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/FSCommandActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/FSCommandActionItem.java index eee0b787b..7ed70f0f0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/FSCommandActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/FSCommandActionItem.java @@ -1,18 +1,19 @@ /* * Copyright (C) 2010-2015 JPEXS, All rights reserved. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3.0 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; @@ -27,8 +28,6 @@ import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.LocalData; import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; /** * @@ -44,15 +43,11 @@ public class FSCommandActionItem extends ActionItem { } @Override - public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) { + public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { writer.append("fscommand"); writer.spaceBeforeCallParenthesies(1); writer.append("("); - try { - command.appendTo(writer, localData); - } catch (InterruptedException ex) { - Logger.getLogger(FSCommandActionItem.class.getName()).log(Level.SEVERE, null, ex); - } + command.appendTo(writer, localData); return writer.append(")"); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/BinaryDataExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/BinaryDataExporter.java index 486331ccd..9ddc99388 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/BinaryDataExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/BinaryDataExporter.java @@ -37,7 +37,7 @@ import java.util.List; */ public class BinaryDataExporter { - public List exportBinaryData(AbortRetryIgnoreHandler handler, String outdir, List tags, BinaryDataExportSettings settings, EventListener evl) throws IOException { + public List exportBinaryData(AbortRetryIgnoreHandler handler, String outdir, List tags, BinaryDataExportSettings settings, EventListener evl) throws IOException, InterruptedException { List ret = new ArrayList<>(); if (tags.isEmpty()) { return ret; @@ -72,6 +72,7 @@ public class BinaryDataExporter { fos.write(((DefineBinaryDataTag) t).binaryData.getRangeData()); } }, handler).run(); + ret.add(file); if (evl != null) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FontExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FontExporter.java index bd7739345..7f1066fc8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FontExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FontExporter.java @@ -56,7 +56,7 @@ import java.util.logging.Logger; */ public class FontExporter { - public List exportFonts(AbortRetryIgnoreHandler handler, String outdir, List tags, final FontExportSettings settings, EventListener evl) throws IOException { + public List exportFonts(AbortRetryIgnoreHandler handler, String outdir, List tags, final FontExportSettings settings, EventListener evl) throws IOException, InterruptedException { List ret = new ArrayList<>(); if (tags.isEmpty()) { return ret; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FrameExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FrameExporter.java index 96714b26f..eff02a84e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FrameExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/FrameExporter.java @@ -91,7 +91,7 @@ public class FrameExporter { private static final Logger logger = Logger.getLogger(FrameExporter.class.getName()); - public List exportFrames(AbortRetryIgnoreHandler handler, String outdir, SWF swf, int containerId, List frames, ButtonExportSettings settings, EventListener evl) throws IOException { + public List exportFrames(AbortRetryIgnoreHandler handler, String outdir, SWF swf, int containerId, List frames, ButtonExportSettings settings, EventListener evl) throws IOException, InterruptedException { FrameExportMode fem; switch (settings.mode) { case BMP: @@ -111,7 +111,7 @@ public class FrameExporter { return exportFrames(handler, outdir, swf, containerId, frames, fes, evl); } - public List exportFrames(AbortRetryIgnoreHandler handler, String outdir, SWF swf, int containerId, List frames, SpriteExportSettings settings, EventListener evl) throws IOException { + public List exportFrames(AbortRetryIgnoreHandler handler, String outdir, SWF swf, int containerId, List frames, SpriteExportSettings settings, EventListener evl) throws IOException, InterruptedException { FrameExportMode fem; switch (settings.mode) { case PNG: @@ -143,7 +143,7 @@ public class FrameExporter { return exportFrames(handler, outdir, swf, containerId, frames, fes, evl); } - public List exportFrames(AbortRetryIgnoreHandler handler, String outdir, final SWF swf, int containerId, List frames, final FrameExportSettings settings, final EventListener evl) throws IOException { + public List exportFrames(AbortRetryIgnoreHandler handler, String outdir, final SWF swf, int containerId, List frames, final FrameExportSettings settings, final EventListener evl) throws IOException, InterruptedException { final List ret = new ArrayList<>(); if (swf.tags.isEmpty()) { return ret; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/ImageExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/ImageExporter.java index be1a16d0d..cb7f0aead 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/ImageExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/ImageExporter.java @@ -42,7 +42,7 @@ import java.util.List; */ public class ImageExporter { - public List exportImages(AbortRetryIgnoreHandler handler, String outdir, List tags, ImageExportSettings settings, EventListener evl) throws IOException { + public List exportImages(AbortRetryIgnoreHandler handler, String outdir, List tags, ImageExportSettings settings, EventListener evl) throws IOException, InterruptedException { List ret = new ArrayList<>(); if (tags.isEmpty()) { return ret; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/MorphShapeExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/MorphShapeExporter.java index cd0c4d8e4..acaa6730f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/MorphShapeExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/MorphShapeExporter.java @@ -51,7 +51,7 @@ import java.util.Set; public class MorphShapeExporter { //TODO: implement morphshape export. How to handle 65536 frames? - public List exportMorphShapes(AbortRetryIgnoreHandler handler, final String outdir, List tags, final MorphShapeExportSettings settings, EventListener evl) throws IOException { + public List exportMorphShapes(AbortRetryIgnoreHandler handler, final String outdir, List tags, final MorphShapeExportSettings settings, EventListener evl) throws IOException, InterruptedException { List ret = new ArrayList<>(); if (tags.isEmpty()) { return ret; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/MovieExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/MovieExporter.java index dd2bab57e..d8e16cb2c 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/MovieExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/MovieExporter.java @@ -48,7 +48,7 @@ import java.util.List; */ public class MovieExporter { - public List exportMovies(AbortRetryIgnoreHandler handler, String outdir, List tags, final MovieExportSettings settings, EventListener evl) throws IOException { + public List exportMovies(AbortRetryIgnoreHandler handler, String outdir, List tags, final MovieExportSettings settings, EventListener evl) throws IOException, InterruptedException { List ret = new ArrayList<>(); if (tags.isEmpty()) { return ret; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/ShapeExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/ShapeExporter.java index a6ac44545..2d50093e6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/ShapeExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/ShapeExporter.java @@ -57,7 +57,7 @@ import java.util.Set; */ public class ShapeExporter { - public List exportShapes(AbortRetryIgnoreHandler handler, final String outdir, List tags, final ShapeExportSettings settings, EventListener evl) throws IOException { + public List exportShapes(AbortRetryIgnoreHandler handler, final String outdir, List tags, final ShapeExportSettings settings, EventListener evl) throws IOException, InterruptedException { List ret = new ArrayList<>(); if (tags.isEmpty()) { return ret; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/SoundExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/SoundExporter.java index 611a6ba39..62cab26e1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/SoundExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/SoundExporter.java @@ -52,7 +52,7 @@ import java.util.List; */ public class SoundExporter { - public List exportSounds(AbortRetryIgnoreHandler handler, String outdir, List tags, final SoundExportSettings settings, EventListener evl) throws IOException { + public List exportSounds(AbortRetryIgnoreHandler handler, String outdir, List tags, final SoundExportSettings settings, EventListener evl) throws IOException, InterruptedException { List ret = new ArrayList<>(); if (tags.isEmpty()) { return ret; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/TextExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/TextExporter.java index e248371fc..da936ebc2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/TextExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/TextExporter.java @@ -48,7 +48,7 @@ public class TextExporter { public static final String TEXT_EXPORT_FILENAME_PLAIN = "textsplain.txt"; - public List exportTexts(AbortRetryIgnoreHandler handler, String outdir, List tags, final TextExportSettings settings, EventListener evl) throws IOException { + public List exportTexts(AbortRetryIgnoreHandler handler, String outdir, List tags, final TextExportSettings settings, EventListener evl) throws IOException, InterruptedException { List ret = new ArrayList<>(); if (tags.isEmpty()) { return ret; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/script/AS2ScriptExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/script/AS2ScriptExporter.java index d75513015..7348d04e0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/script/AS2ScriptExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/script/AS2ScriptExporter.java @@ -74,7 +74,7 @@ public class AS2ScriptExporter { return new ArrayList<>(); } - private List exportAS2Scripts(AbortRetryIgnoreHandler handler, String outdir, Map asms, ScriptExportSettings exportSettings, EventListener evl) throws IOException { + private List exportAS2Scripts(AbortRetryIgnoreHandler handler, String outdir, Map asms, ScriptExportSettings exportSettings, EventListener evl) throws IOException, InterruptedException { List ret = new ArrayList<>(); if (!outdir.endsWith(File.separator)) { outdir += File.separator; @@ -111,7 +111,7 @@ public class AS2ScriptExporter { return ret; } - private File exportAS2Script(AbortRetryIgnoreHandler handler, String outdir, ASMSource asm, ScriptExportSettings exportSettings, EventListener evl, AtomicInteger index, int count, String name) throws IOException { + private File exportAS2Script(AbortRetryIgnoreHandler handler, String outdir, ASMSource asm, ScriptExportSettings exportSettings, EventListener evl, AtomicInteger index, int count, String name) throws IOException, InterruptedException { boolean retry; do { retry = false; @@ -157,6 +157,7 @@ public class AS2ScriptExporter { return file; } catch (InterruptedException ex) { + throw ex; } catch (IOException | OutOfMemoryError | TranslateException | StackOverflowError ex) { logger.log(Level.SEVERE, "Decompilation error in script: " + name, ex); if (handler != null) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/script/AS3ScriptExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/script/AS3ScriptExporter.java index 2e714c208..02e863571 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/script/AS3ScriptExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/script/AS3ScriptExporter.java @@ -58,9 +58,14 @@ public class AS3ScriptExporter { @Override public Void call() throws Exception { for (ScriptPack item : packs) { + if (Thread.currentThread().isInterrupted()) { + throw new InterruptedException(); + } + if (!item.isSimple && Configuration.ignoreCLikePackages.get()) { continue; } + ExportPackTask task = new ExportPackTask(handler, cnt, packs.size(), item.getClassPath(), item, outdir, exportSettings, parallel, evl); ret.add(task.call()); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/script/ExportPackTask.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/script/ExportPackTask.java index e4898be16..e79a64df0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/script/ExportPackTask.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/script/ExportPackTask.java @@ -74,7 +74,7 @@ public class ExportPackTask implements Callable { public File call() throws Exception { RunnableIOExResult rio = new RunnableIOExResult() { @Override - public void run() throws IOException { + public void run() throws IOException, InterruptedException { startTime = System.currentTimeMillis(); this.result = pack.export(directory, exportSettings, parallel); stopTime = System.currentTimeMillis(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/SWFDecompilerListener.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/SWFDecompilerListener.java index 0a03c0b7f..cd0cc8c21 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/SWFDecompilerListener.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/SWFDecompilerListener.java @@ -1,18 +1,19 @@ /* * Copyright (C) 2010-2015 JPEXS, All rights reserved. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3.0 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.helpers; import com.jpexs.decompiler.flash.SWF; @@ -30,7 +31,7 @@ public interface SWFDecompilerListener { void swfParsed(SWF swf); - void actionListParsed(ActionList actions, SWF swf); + void actionListParsed(ActionList actions, SWF swf) throws InterruptedException; void abcParsed(ABC abc, SWF swf); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java index 169e58a7b..a5d9b682e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java @@ -2287,7 +2287,7 @@ public class XFLConverter { return ret.toString(); } - private static void writeFile(AbortRetryIgnoreHandler handler, final byte[] data, final String file) throws IOException { + private static void writeFile(AbortRetryIgnoreHandler handler, final byte[] data, final String file) throws IOException, InterruptedException { new RetryTask(() -> { try (FileOutputStream fos = new FileOutputStream(file)) { fos.write(data); @@ -2654,7 +2654,7 @@ public class XFLConverter { return ret.toString(); } - public static void convertSWF(AbortRetryIgnoreHandler handler, SWF swf, String swfFileName, String outfile, boolean compressed, String generator, String generatorVerName, String generatorVersion, boolean parallel, FLAVersion flaVersion) throws IOException { + public static void convertSWF(AbortRetryIgnoreHandler handler, SWF swf, String swfFileName, String outfile, boolean compressed, String generator, String generatorVerName, String generatorVersion, boolean parallel, FLAVersion flaVersion) throws IOException, InterruptedException { FileAttributesTag fa = swf.getFileAttributes(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphSource.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphSource.java index 814acad44..e6b6534f6 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphSource.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/GraphSource.java @@ -1,16 +1,16 @@ /* * Copyright (C) 2010-2015 JPEXS, All rights reserved. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3.0 of the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library. */ @@ -41,6 +41,7 @@ public abstract class GraphSource implements Serializable { if (Thread.currentThread().isInterrupted()) { throw new InterruptedException(); } + boolean debugMode = false; while (((endIp == -1) || (ip < endIp)) && (ip < size())) { refs.get(ip).add(lastIp); diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 715eb41d9..dc4c8d111 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -567,7 +567,13 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se File ftemp = new File(tempDir); ExportDialog exd = new ExportDialog(null); - files = exportSelection(new GuiAbortRetryIgnoreHandler(), tempDir, exd); + try { + files = exportSelection(new GuiAbortRetryIgnoreHandler(), tempDir, exd); + } catch (InterruptedException ex) { + Logger.getLogger(MainPanel.class.getName()).log(Level.SEVERE, null, ex); + return null; + } + files.clear(); File[] fs = ftemp.listFiles(); @@ -1035,7 +1041,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se return View.showConfirmDialog(null, translate("message.confirm.experimental"), translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION; } - public List exportSelection(AbortRetryIgnoreHandler handler, String selFile, ExportDialog export) throws IOException { + public List exportSelection(AbortRetryIgnoreHandler handler, String selFile, ExportDialog export) throws IOException, InterruptedException { List ret = new ArrayList<>(); List sel = folderPreviewPanel.selectedItems.isEmpty() ? tagTree.getAllSelected(tagTree) : new ArrayList<>(folderPreviewPanel.selectedItems.values()); @@ -1259,7 +1265,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se return ret; } - public void exportAll(SWF swf, AbortRetryIgnoreHandler handler, String selFile, ExportDialog export) throws IOException { + public void exportAll(SWF swf, AbortRetryIgnoreHandler handler, String selFile, ExportDialog export) throws IOException, InterruptedException { boolean exportAll = false; if (exportAll) { exportAllDebug(swf, handler, selFile, export); @@ -1352,7 +1358,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } } - public void exportAllDebug(SWF swf, AbortRetryIgnoreHandler handler, String selFile, ExportDialog export) throws IOException { + public void exportAllDebug(SWF swf, AbortRetryIgnoreHandler handler, String selFile, ExportDialog export) throws IOException, InterruptedException { EventListener evl = swf.getExportEventListener(); if (export.isOptionEnabled(ImageExportMode.class)) { diff --git a/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java b/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java index 3e8a72763..e79ceb5b4 100644 --- a/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java +++ b/src/com/jpexs/decompiler/flash/gui/proxy/ProxyFrame.java @@ -455,7 +455,7 @@ public class ProxyFrame extends AppFrame implements CatchedListener, MouseListen Files.copy(new File(r.targetFile).toPath(), outfile.toPath(), StandardCopyOption.REPLACE_EXISTING); } }, handler).run(); - } catch (IOException ex) { + } catch (IOException | InterruptedException ex) { break; } }