#93 NullPointerException in TeeOutputStream

open
nobody
None
5
2012-04-10
2012-04-10
No

The class TeeOutputStream is used to redirect System.out, and so is used from multiple threads. It is, however, not thread-safe.

The relevant part of the code is the following:

class TeeOutputStream {
private OutputStream log;
public void closeLog() { log = null; }
public void write() { if (log != null) /* here another thread calls closeLog */ log.write(); }
}

I have observed this bug with the tomcat benchmark. But, being a concurrency bug, it is hard to reproduce.

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks