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

Brian Burkhalter brian.burkhalter at oracle.com
Fri Jul 26 19:01:01 UTC 2019

> On Jul 26, 2019, at 11:36 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> On 26/07/2019 16:41, Brian Burkhalter wrote:
>> :
>> Please see the updated patch which switches the implementation to the amended version and incorporates the proposed change to the test:
>> http://cr.openjdk.java.net/~bpb/8078891/webrev.01/ <http://cr.openjdk.java.net/~bpb/8078891/webrev.01/>
> The bug summary might be a big misleading as SequenceInputStream isn't thread safe and close isn't atomic. The changes are really to attempt to close all the remaining streams rather than bailing out when closing one of them fails.
> In any case, the change looks okay but it might be simpler to restructure to use:
> while (in != null) {
>     try { in.close() } catch (IOException e) { ... }
>     peekNextStream();
> }
> to simplify the error handling and avoid mixing nextStream and peekNextStream.

So updated: http://cr.openjdk.java.net/~bpb/8078891/webrev.02/

> There is also some curious code in peekNextStream where it handles nextElement returning null - I don't know the history on that but it looks like it's trying to handling a broken Enumeration.

Strange but not changed.



More information about the core-libs-dev mailing list