RFR: 8321180: Condition for non-latin1 string size too large exception is off by one [v2]
Roger Riggs
rriggs at openjdk.org
Fri Dec 8 19:50:30 UTC 2023
> In the compact string implementation of non-latin1 (UTF16) strings the length is constrained by VM implementation limit on the size a byte array that can be allocated. To produce a useful exception the implementation checks the string size against the maximum byte array size. The exception message is correct
>
> "UTF16 String size is " + len + ", should be less than or equal to " + MAX_LENGTH
>
> The code should match the message, otherwise the exception thrown is:
>
> java.lang.OutOfMemoryError: Requested array size exceeds VM limit
Roger Riggs has updated the pull request incrementally with one additional commit since the last revision:
As suggested by reviewers
Correct exception message text
Removed unused imports
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/17008/files
- new: https://git.openjdk.org/jdk/pull/17008/files/f2de15ac..2f03e1f2
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=17008&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=17008&range=00-01
Stats: 4 lines in 2 files changed: 0 ins; 3 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/17008.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/17008/head:pull/17008
PR: https://git.openjdk.org/jdk/pull/17008
More information about the core-libs-dev
mailing list