ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject AW: custom task calls classes with logging = NPE
Date Mon, 30 Aug 2004 05:28:20 GMT
> I understand that Ant is closing the System.out and 
> System.err streams and I can kinda appreciate
> why it's doing that, but it's proving to be a problem for me, 
> since my task calls various classes
> that are not aware of ant and those classes use logging and 
> possibly even direct references to to
> System.out causing my task to fail with a NullPointerException.

I´m not aware that Ant _closes_ these streams ...
Ant uses its own streams: System.setIn(new DemuxInputStream(project)); System.setOut(new PrintStream(new DemuxOutputStream(project,
false))); System.setErr(new PrintStream(new DemuxOutputStream(project,

"Logs content written by a thread and forwards the buffers onto the
project object which will forward the content to the appropriate task."

> In short, I'd like to know how one deals with that.

The usual way for logging is invoking the tasks log() method ...
For your external classes: <java> supports a <redirector>. Maybe you can do
with that (its early in the morning - maybe thats not the best idea...)


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message