FilterOutputStream.close() throws exception from flush()
Alan Bateman
Alan.Bateman at oracle.com
Fri Feb 10 05:43:19 PST 2012
On 10/02/2012 13:16, Alex Lam S.L. wrote:
> I think I have narrowed it down to this changeset:
>
> http://hg.openjdk.java.net/hsx/hotspot-rt/jdk/rev/759aa847dcaf
>
> 7015589: (spec) BufferedWriter.close leaves stream open if close of
> underlying Writer fails
>
> Which no longer catches and ignores the exception thrown by flush():
>
> try (OutputStream ostream = out) {
> flush();
> }
>
> To recover the previous behaviour, I think the following might just work:
>
> try (OutputStream ostream = out) {
> flush();
> } catch (IOException ignored) {
> }
>
>
> Regards,
> Alex.
Ignoring the exception means your code will be oblivious to the error.
Please follow-up on the thread on core-libs-dev as that is the list
where discussed this issue prior to the change.
-Alan
More information about the jdk8-dev
mailing list