aboutsummaryrefslogtreecommitdiff
path: root/baksmali
diff options
context:
space:
mode:
authorBen Gruver <bgruv@google.com>2013-12-12 01:37:14 -0800
committerBen Gruver <bgruv@google.com>2013-12-12 01:37:14 -0800
commiteae0b0edbf3f0feedc289655144c54d27cb2ddcc (patch)
tree2cf92ab777891ee5632556a9358d6061439a6c0b /baksmali
parent029ad25c66e37600f68a95015715d091543c7072 (diff)
downloadsmali-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.java26
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;
}