Author: jglick
Date: Tue Nov 17 23:56:21 2009
New Revision: 881627
URL: http://svn.apache.org/viewvc?rev=881627&view=rev
Log:
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.
Modified:
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SubAnt.java
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SubAnt.java
URL:
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SubAnt.java?rev=881627&r1=881626&r2=881627&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SubAnt.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SubAnt.java Tue Nov
17 23:56:21 2009
@@ -301,18 +301,14 @@
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 @@
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.