FilterOutputStream.close() throws exception from flush()
Alex Lam S.L.
alexlamsl at gmail.com
Fri Feb 10 19:54:52 UTC 2012
It sounds very reasonable when you put it that way ;-)
I was thinking along the lines of when flush() fails - clearly you
can't flush a stream when it is closed - then it should throw an
Either way - I will sleep some more on my code and work around this in JDK8.
Thank you and Alan for all the good advices!
On Fri, Feb 10, 2012 at 2:13 PM, Rémi Forax <forax at univ-mlv.fr> wrote:
> 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?
> 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