RFR: 8321514: UTF16 string gets constructed incorrectly from codepoints if CompactStrings is not enabled

Aleksei Voitylov avoitylov at openjdk.org
Mon Dec 11 15:08:28 UTC 2023


Since JDK-8311906, if CompactStrings is not enabled, index is not considered when calling extractCodepoints from StringUTF16.toBytes(). Because of that the last elements of the source codepoints array are stripped from the resulting UTF16 string, which fires in other places (e.g. during RegEx processing).
 
The fix replaces len in extractCodepoints parameters with end that is index + len.

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

Commit messages:
 - whitespace
 - JDK-8321514 implementation

Changes: https://git.openjdk.org/jdk/pull/17057/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=17057&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8321514
  Stats: 46 lines in 2 files changed: 45 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/17057.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/17057/head:pull/17057

PR: https://git.openjdk.org/jdk/pull/17057


More information about the core-libs-dev mailing list