8078891: java.io.SequenceInputStream.close is not atomic and not idempotent

Pavel Rappo pavel.rappo at oracle.com
Thu Jul 25 19:43:43 UTC 2019


Brian,

Thanks a lot for picking up a bug I filled back in 2015. This looks like a good
cleanup!

I'm a bit concerned though with the added `finally` block in L98. Could that
lead to a subtle behavioral change for (an unlikely) case where a `read` method
exhausts the current stream, then tries to close it, fails (`close` throws
IOException) and then jumps over to the next stream instead of staying on the
current one?

Previously, `read` would be tripping over a closed stream forever. 

Theoretically speaking, we might have a case of a "non-sticky" error in the
InputStream. Try to read, fail, try to read again -- you might get lucky.

Thanks,
-Pavel

> On 24 Jul 2019, at 01:09, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:
> 
> https://bugs.openjdk.java.net/browse/JDK-8078891
> http://cr.openjdk.java.net/~bpb/8078891/webrev.00/
> 
> Ensure that SequenceInputStream closes all component streams.
> 
> Thanks,
> 
> Brian



More information about the core-libs-dev mailing list