BufferedWriter.write does not throw exception if it is already closed.

Alan Bateman Alan.Bateman at oracle.com
Tue Jan 25 16:19:04 UTC 2011

Jing LV wrote:
> Hello,
> I find a problem in java.io.BufferedWriter. It is stated in the java
> spec of its close() method:
> "... Once the stream has been closed, further write() or flush()
> invocations will cause an IOException to be thrown."
> However if a BufferedWriter is created with a delegated writer, then it
> seems to "forget" to throw IOException when it's closed, even if the
> delegated writer wants to. Here is a simple example:
It's possible we have a spec issue in that BufferedWriter (and others) 
don't specify what their state is in event that flushing or closing the 
underlying Writer fails (the test is assuming that it is closed even 
though the close method failed).


More information about the core-libs-dev mailing list