Browse Source

Fixing fix for OOME in <subant>.

Was getting wrapped in BuildException by both DispatchUtils.execute and Project.executeSortedTargets.
Instead of trying to prevent wrapping, which is difficult to enforce, just die on wrapped hard errors.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@881627 13f79535-47bb-0310-9956-ffa450edef68
master
Jesse N. Glick 15 years ago
parent
commit
fbd5fe56fc
1 changed files with 14 additions and 6 deletions
  1. +14
    -6
      src/main/org/apache/tools/ant/taskdefs/SubAnt.java

+ 14
- 6
src/main/org/apache/tools/ant/taskdefs/SubAnt.java View File

@@ -301,18 +301,14 @@ public class SubAnt extends Task {
try {
ant.execute();
} catch (BuildException e) {
if (failOnError) {
if (failOnError || isHardError(e)) {
throw e;
}
log("Failure for target '" + subTarget
+ "' of: " + antfilename + "\n"
+ e.getMessage(), Project.MSG_WARN);
} catch (OutOfMemoryError e) {
throw e;
} catch (ThreadDeath e) {
throw e;
} catch (Throwable e) {
if (failOnError) {
if (failOnError || isHardError(e)) {
throw new BuildException(e);
}
log("Failure for target '" + subTarget
@@ -323,6 +319,18 @@ public class SubAnt extends Task {
ant = null;
}
}
/** whether we should even try to continue after this error */
private boolean isHardError(Throwable t) {
if (t instanceof BuildException) {
return isHardError(t.getCause());
} else if (t instanceof OutOfMemoryError) {
return true;
} else if (t instanceof ThreadDeath) {
return true;
} else { // incl. t == null
return false;
}
}

/**
* This method builds the file name to use in conjunction with directories.


Loading…
Cancel
Save