FilterOutputStream.close() throws exception from flush()

Rémi Forax forax at
Fri Feb 10 14:13:07 UTC 2012

On 02/10/2012 02:52 PM, 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?
> Regards,
> Alex.

In my opinion, flush() should not throw an exception when the stream is 
close() doesn't throw an exception in that case and close() should be 
able to call flush().


More information about the core-libs-dev mailing list