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

Alan Bateman Alan.Bateman at oracle.com
Sat Jul 27 07:28:06 UTC 2019

On 26/07/2019 20:37, Pavel Rappo wrote:
> For the record. If we change this as you suggested, the code will behave
> differently in the case of a single `null` element found in the midst of
> iteration (broken enumeration?). The stream won't be able to close after
> running into it. But this most likely is a programming error anyway.
The changes in webrev.01 probably have the same issue because nextStream 
will throw NPE when nextElement returns null and this will terminate the 
close without closing the streams that follow the null. Yeah, it's a 
usage/programming error. peekNextStream could include an exception 
message to help with such cases but it hardly seems worth trying to do more.


More information about the core-libs-dev mailing list