Browse Source

Silently ignore messages being written to System.err/out while a Listener is processing a different message

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277362 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 20 years ago
parent
commit
e76559e2f3
2 changed files with 19 additions and 4 deletions
  1. +5
    -0
      WHATSNEW
  2. +14
    -4
      src/main/org/apache/tools/ant/Project.java

+ 5
- 0
WHATSNEW View File

@@ -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:
-----------



+ 14
- 4
src/main/org/apache/tools/ant/Project.java View File

@@ -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;


Loading…
Cancel
Save