On Sat, 8 Aug 2026 17:04:56 GMT, Alan Bateman <[email protected]> wrote:

>> src/java.base/share/classes/sun/nio/cs/StreamDecoder.java line 239:
>> 
>>> 237:             }
>>> 238: 
>>> 239:             return cb.flip().toString();
>> 
>> Have you tested this with underflow? From a quick loop I can't tell if this 
>> will go into an infinite loop or leave unconsumed chars.
>
>> Have you tested this with underflow? From a quick loop I can't tell if this 
>> will go into an infinite loop or leave unconsumed chars.
> 
> I just checked with input that is the first 2 bytes of UTF-8 "€" (E2 82 AC) 
> and it does go into an infinite loop. So I think more tests will be required.

Thank you so much for this tip! Indeed I missed this case in both the code and 
the test. Have corrected the code now and added much more tests which (so I 
hope) now cover all the different cases like underflown / non-underflown, empty 
charset decoder, completely filled buffer, etc.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32264#discussion_r3789106136

Reply via email to