RFR 8190500: (ch) ReadableByteChannelImpl::read and WritableByteChannelImpl::write might not throw ClosedChannelException as specified
Alan Bateman
Alan.Bateman at oracle.com
Fri Nov 3 12:04:23 UTC 2017
On 02/11/2017 18:23, Brian Burkhalter wrote:
>
> On Nov 2, 2017, at 9:36 AM, Alan Bateman <Alan.Bateman at oracle.com
> <mailto:Alan.Bateman at oracle.com>> wrote:
>
>> I don't wish to delay you on this but looking at it again then it
>> might be better to put the tests for the closed channel into their
>> own methods so that testNewChannelIn and testNewChannelOut test one
>> thing each.
>
> No worries; I agree that is better. Here’s an updated version:
> http://cr.openjdk.java.net/~bpb/8190500/webrev.01/
> <http://cr.openjdk.java.net/%7Ebpb/8190500/webrev.01/>
>
It might be better to put the fos.close and fis.close into a finally
block, or else else using try-with-resources in both methods. They
aren't of course strictly needed but you've invited the question by
allowing for the possibility that wbc/rbc.close doesn't close the
underlying stream.
-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20171103/e74742c4/attachment.html>
More information about the nio-dev
mailing list