RFR: 8329623: NegativeArraySizeException encoding large String to UTF-8

Roger Riggs rriggs at openjdk.org
Fri Apr 5 22:00:05 UTC 2024


On Fri, 5 Apr 2024 20:17:39 GMT, Naoto Sato <naoto at openjdk.org> wrote:

> LGTM. The test case could be more thorough if it tests strings with supplementary codepoints, as the new method computes them exclusively.

I considered that, but the worst case is the x3 expansion. 
A 2 character high/low surrogate pair would result in 4 bytes of UTF-8, less than the 6 bytes needed for a 2 16 bit characters. The test doesn't run quickly already due to the large chunks of memory used.

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

PR Comment: https://git.openjdk.org/jdk/pull/18663#issuecomment-2040681452


More information about the core-libs-dev mailing list