8078891: java.io.SequenceInputStream.close is not atomic and not idempotent
Alan Bateman
Alan.Bateman at oracle.com
Fri Jul 26 18:36:31 UTC 2019
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/
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. 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.
-Alan
More information about the core-libs-dev
mailing list