diff options
-rw-r--r-- | src/java/net/sf/antcontrib/logic/TryCatchTask.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/java/net/sf/antcontrib/logic/TryCatchTask.java b/src/java/net/sf/antcontrib/logic/TryCatchTask.java index 4933e7d..11d31bf 100644 --- a/src/java/net/sf/antcontrib/logic/TryCatchTask.java +++ b/src/java/net/sf/antcontrib/logic/TryCatchTask.java @@ -197,6 +197,8 @@ public class TryCatchTask extends Task { * The heart of the task. */ public void execute() throws BuildException { + Throwable thrown = null; + if (tryTasks == null) { throw new BuildException("A nested <try> element is required"); } @@ -222,11 +224,19 @@ public class TryCatchTask extends Task { CatchBlock cb = (CatchBlock)blocks.nextElement(); executed = cb.execute(e); } + + if (! executed) { + thrown = e; + } } finally { if (finallyTasks != null) { finallyTasks.perform(); } } + + if (thrown != null) { + throw new BuildException(thrown); + } } } |