On Tue, 27 Apr 2021 20:25:32 GMT, Brian Burkhalter <b...@openjdk.org> wrote:

>> Please consider this request to modify `Reader.read(CharBuffer)` to check 
>> whether the buffer is read-only before reading any characters from the 
>> character stream. This can happen now if the buffer is read-only. Character 
>> are first read thereby advancing the stream before an attempt is made to put 
>> them in the `CharBuffer` thus incorrectly advancing the stream position.
>
> Brian Burkhalter has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   8266078: Make read-only check global; add message in test

Marked as reviewed by alanb (Reviewer).

src/java.base/share/classes/java/io/Reader.java line 206:

> 204:             char[] cbuf = new char[len];
> 205:             // If a read-only check had not been done above, then
> 206:             // the stream would be incorrectly advanced here.

The RO check is good but I'm not sure that this comment is useful (it might 
confuse future maintainers), I would be tempted to leave that part out.

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

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

Reply via email to