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

Brian Burkhalter bpb at openjdk.java.net
Tue Oct 12 18:21:51 UTC 2021


On Tue, 12 Oct 2021 17:56:59 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> This small change would modify `java.nio.channels.Channels$ReadableByteChannelImpl.read(ByteBuffer)` to throw an `IllegalArgumentException` if the `ByteBuffer` parameter is read-only as required by its specification instead of the `ReadOnlyBufferException` currently thrown.

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?

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

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


More information about the nio-dev mailing list