RFR 8190500: (ch) ReadableByteChannelImpl::read and WritableByteChannelImpl::write might not throw ClosedChannelException as specified

Alan Bateman Alan.Bateman at oracle.com
Thu Nov 2 08:30:47 UTC 2017


On 02/11/2017 00:55, Brian Burkhalter wrote:
> https://bugs.openjdk.java.net/browse/JDK-8190500
> http://cr.openjdk.java.net/~bpb/8190500/webrev.00/
>
> Closing the channel returned by Channels::newChannel can result in a subsequent read/write's throwing an IOException instead of the expected ClosedChannelException in for a non-FileIn/OutputStream parameter.
>
The change looks okay. Related is that someone with a reference to the 
underlying InputStream/OutpuStream could close the stream so that the 
channel read/write throw an IOException other than 
AsynchronousCloseException but that isn't something you can solve.

For the test then you might want to break up the really long lines to 
keep it consistent with the rest of the test.

-Alan


More information about the nio-dev mailing list