<i18n dev> RFR: 8349883: Locale.LanguageRange.parse("-") throws ArrayIndexOutOfBoundsException

Justin Lu jlu at openjdk.org
Wed Feb 12 19:39:33 UTC 2025


Please review this PR which prevents a (non-specified) `AIOOBE` from leaking out of the range accepting endpoints in `Locale.LanguageRange`.

In the reported error case, the invalid range is a lone "-" which is `split` into an empty array. Checking if the range ends with "-" first, avoids indexing the empty array.

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

Commit messages:
 - init

Changes: https://git.openjdk.org/jdk/pull/23596/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23596&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8349883
  Stats: 76 lines in 2 files changed: 71 ins; 2 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/23596.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23596/head:pull/23596

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


More information about the i18n-dev mailing list