On Fri, 5 Apr 2024 17:44:38 GMT, Roger Riggs <rri...@openjdk.org> wrote:
> When encoding a vary large string in String.getBytes(StandardCharset.UTF_8) > computation of the buffer size may exceed the range of a positive 32-bit > Integer. > If the estimated size for the result byte array is too large, pre-compute the > exact buffer size. > If that exceeds the range, then throw OutOfMemoryError. LGTM. The test case could be more thorough if it tests strings with supplementary codepoints, as the new method computes them exclusively. ------------- Marked as reviewed by naoto (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/18663#pullrequestreview-1984117426