Browse Source

get Task#perform() to wrap all exceptions with a buildexception

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276556 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 21 years ago
parent
commit
e8e4255032
2 changed files with 15 additions and 8 deletions
  1. +3
    -0
      WHATSNEW
  2. +12
    -8
      src/main/org/apache/tools/ant/Task.java

+ 3
- 0
WHATSNEW View File

@@ -46,6 +46,9 @@ Changes that could break older environments:
didn't depend on Xalan-J 2 at all. Its sole dependency has always
been TraX and so it has been merged into ant-trax.jar.

* All exceptions thrown by tasks are now wrapped in a buildexception
giving the location in the buildfile of the task.

Fixed bugs:
-----------



+ 12
- 8
src/main/org/apache/tools/ant/Task.java View File

@@ -362,15 +362,19 @@ public abstract class Task extends ProjectComponent {
try {
maybeConfigure();
execute();
} catch (RuntimeException exc) {
if (exc instanceof BuildException) {
BuildException be = (BuildException) exc;
if (be.getLocation() == Location.UNKNOWN_LOCATION) {
be.setLocation(getLocation());
}
} catch (BuildException ex) {
if (ex.getLocation() == Location.UNKNOWN_LOCATION) {
ex.setLocation(getLocation());
}
reason = exc;
throw exc;
reason = ex;
} catch (Exception ex) {
reason = ex;
BuildException be = new BuildException(ex);
be.setLocation(getLocation());
throw be;
} catch (Error ex) {
reason = ex;
throw ex;
} finally {
getProject().fireTaskFinished(this, reason);
}


Loading…
Cancel
Save