FilterOutputStream.close() throws exception from flush()

Alan Bateman Alan.Bateman at
Fri Feb 10 14:15:21 UTC 2012

On 10/02/2012 13:52, Alex Lam S.L. wrote:
> Hi there,
> Thanks for the pointer - I wasn't able to trace back to that email for
> some reasons.
> The problem is that:
>   - flush() is reporting IOException because underlying stream is closed
>   - close() is then forwarding that IOException now in JavaSE 8
> I guess my question is: what is the best way to check and avoid the
> case where OutputStream is already closed?
Do you know what the type of the underlying stream is? Clearly flush 
should fail if there are bytes to flush and the stream is open. Whether 
calling flush on a closed stream should fail or not isn't clear from the 


More information about the core-libs-dev mailing list