diff options
author | Ben Gruver <bgruv@google.com> | 2013-12-12 01:37:14 -0800 |
---|---|---|
committer | Ben Gruver <bgruv@google.com> | 2013-12-12 01:37:14 -0800 |
commit | eae0b0edbf3f0feedc289655144c54d27cb2ddcc (patch) | |
tree | 2cf92ab777891ee5632556a9358d6061439a6c0b /baksmali | |
parent | 029ad25c66e37600f68a95015715d091543c7072 (diff) | |
download | smali-eae0b0edbf3f0feedc289655144c54d27cb2ddcc.tar.gz |
Make sure we always shut down the executor
Previously, an ExecutionException from the task could cause the process
to hang, because the ExecutorService was never shut down
Diffstat (limited to 'baksmali')
-rw-r--r-- | baksmali/src/main/java/org/jf/baksmali/baksmali.java | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/baksmali/src/main/java/org/jf/baksmali/baksmali.java b/baksmali/src/main/java/org/jf/baksmali/baksmali.java index dc49640f..fcc89d7a 100644 --- a/baksmali/src/main/java/org/jf/baksmali/baksmali.java +++ b/baksmali/src/main/java/org/jf/baksmali/baksmali.java @@ -147,22 +147,24 @@ public class baksmali { } boolean errorOccurred = false; - for (Future<Boolean> task: tasks) { - while(true) { - try { - if (!task.get()) { - errorOccurred = true; + try { + for (Future<Boolean> task: tasks) { + while(true) { + try { + if (!task.get()) { + errorOccurred = true; + } + } catch (InterruptedException ex) { + continue; + } catch (ExecutionException ex) { + throw new RuntimeException(ex); } - } catch (InterruptedException ex) { - continue; - } catch (ExecutionException ex) { - throw new RuntimeException(ex); + break; } - break; } + } finally { + executor.shutdown(); } - - executor.shutdown(); return !errorOccurred; } |