diff --git a/WHATSNEW b/WHATSNEW index 3c52b96d3..f875507ae 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -177,6 +177,11 @@ Other changes: * The jikes compiler adapter now supports -bootclasspath. Bugzilla Report 32609. +* When a BuildListener tried to access System.err or System.out, Ant + would have thrown an exception - this has been changed. Ant now + silently ignores the message. BuildListeners still should avoid + accessing either stream. + Fixed bugs: ----------- diff --git a/src/main/org/apache/tools/ant/Project.java b/src/main/org/apache/tools/ant/Project.java index a19105958..49794ed3e 100644 --- a/src/main/org/apache/tools/ant/Project.java +++ b/src/main/org/apache/tools/ant/Project.java @@ -1982,10 +1982,20 @@ public class Project { } synchronized (this) { if (loggingMessage) { - throw new BuildException("Listener attempted to access " - + (priority == MSG_ERR ? "System.err" : "System.out") - + " with message [" + message - + "] - infinite loop terminated"); + /* + * One of the Listeners has attempted to access + * System.err or System.out. + * + * We used to throw an exception in this case, but + * sometimes Listeners can't prevent it(like our own + * Log4jListener which invokes getLogger() which in + * turn wants to write to the console). + * + * @see http://marc.theaimsgroup.com/?t=110538624200006&r=1&w=2 + * + * We now (Ant 1.7 and 1.6.3) simply swallow the message. + */ + return; } try { loggingMessage = true;