mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-28 01:20:46 +00:00
Fixed: Cannot properly cancel script searching
This commit is contained in:
@@ -62,6 +62,7 @@ import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
@@ -255,14 +256,22 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
logger.log(Level.SEVERE, "Decompilation timeout", ex);
|
||||
Helper.appendTimeoutCommentAs3(writer, timeout, 0);
|
||||
return;
|
||||
} catch (CancellationException ex) {
|
||||
throw new InterruptedException();
|
||||
} catch (ExecutionException ex) {
|
||||
writer.continueMeasure();
|
||||
Exception convertException = ex;
|
||||
Throwable cause = ex.getCause();
|
||||
if (ex instanceof ExecutionException && cause instanceof Exception) {
|
||||
if (cause instanceof Exception) {
|
||||
convertException = (Exception) cause;
|
||||
}
|
||||
|
||||
if (convertException instanceof CancellationException) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
if (convertException instanceof InterruptedException) {
|
||||
throw (InterruptedException) convertException;
|
||||
}
|
||||
logger.log(Level.SEVERE, "Decompilation error", convertException);
|
||||
Helper.appendErrorComment(writer, convertException);
|
||||
return;
|
||||
|
||||
@@ -52,6 +52,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
@@ -326,9 +327,10 @@ public final class MethodBody implements Cloneable {
|
||||
}
|
||||
} catch (InterruptedException ex) {
|
||||
throw ex;
|
||||
} catch (CancellationException ex) {
|
||||
throw new InterruptedException();
|
||||
} catch (Exception | OutOfMemoryError | StackOverflowError ex) {
|
||||
convertException = ex;
|
||||
ex.printStackTrace();
|
||||
Throwable cause = ex.getCause();
|
||||
if (ex instanceof ExecutionException && cause instanceof Exception) {
|
||||
convertException = (Exception) cause;
|
||||
|
||||
Reference in New Issue
Block a user