RFR: 4619075: (ch) newChannel() should return Gathering/ScatteringByteChannel [v3]
Brian Burkhalter
bpb at openjdk.java.net
Wed Oct 20 16:40:49 UTC 2021
On Tue, 19 Oct 2021 06:53:50 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 4619075: Add @since tags to new methods
>
> src/java.base/share/classes/java/nio/channels/Channels.java line 378:
>
>> 376: long totalBytesRead = 0L;
>> 377: int maxIndex = offset + length;
>> 378: for (int i = offset; i < maxIndex; i++) {
>
> There are a few problems with this loop. If the second/subsequent buffer is read only then it will throw IllegalArgumentException after reading bytes into the first buffer. It also doesn't happen cases where there are I/O exceptions thrown after some bytes have been read.
Read-only check is fixed. Not sure what to do about IOEs after bytes have been read.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5922
More information about the nio-dev
mailing list