RFR: 8275149: (ch) ReadableByteChannel returned by Channels.newChannel(InputStream) throws ReadOnlyBufferException

Alan Bateman alanb at openjdk.java.net
Tue Oct 12 18:31:50 UTC 2021


On Tue, 12 Oct 2021 18:18:49 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Do you think it would be better instead to change the specification to say it throws `ReadOnlyBufferException` instead of IAE, i.e., to match existing behavior?

I checked a few of the channel implementations and they throw the expected IAE. It looks like the only ReadableByteChannel that throws ReadOnlyBufferException is the implementation returned by newChannel. So I think the change is okay and not risky. We should try to see if there is any code that is catching ReadOnlyBufferException.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5914


More information about the nio-dev mailing list