Would it not be better to do something like this:

if (loggingMessage) {

  PrintStream tempErr = new PrintStream (new FileOutputStream 
(FileDescriptor.err));
              tempErr.println (message);
}

That way the message is not swallowed & lost?

-- 
Jeffrey E. Care ([EMAIL PROTECTED])
WebSphere Build SWAT Team Lead
WebSphere Build Tooling Lead (Project Mantis)
https://w3.opensource.ibm.com/projects/mantis


[EMAIL PROTECTED] wrote on 01/14/2005 05:09:23 AM:

> bodewig     2005/01/14 02:09:23
> 
>   Modified:    src/main/org/apache/tools/ant Project.java
>   Log:
>   Silently ignore messages being written to System.err/out while a 
> Listener is processing a different message
> 
>   Revision  Changes    Path
>   1.183     +15 -5     ant/src/main/org/apache/tools/ant/Project.java
> 
>   Index: Project.java
>   ===================================================================
>   RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/Project.java,v
>   retrieving revision 1.182
>   retrieving revision 1.183
>   diff -u -r1.182 -r1.183
>   --- Project.java   10 Jan 2005 23:44:57 -0000   1.182
>   +++ Project.java   14 Jan 2005 10:09:23 -0000   1.183
>   @@ -1982,10 +1982,20 @@
>            }
>            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;
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

Reply via email to