RFR: 8350646: Calendar.Builder.build() Throws ArrayIndexOutOfBoundsException [v2]

Justin Lu jlu at openjdk.org
Wed Feb 26 18:26:15 UTC 2025


> Please review this PR which prevents an `AIOOBE` from leaking out when `java.util.Calendar.Builder` is used to build a Japanese calendar with an era value too large.
> 
> Note that we don't check under `BEFORE_MEIJI`/0 as historically Japanese calendar ignores negative values during normalization. See `JapaneseImperialCalendar` L2018: `date.setEra(era > 0 ? eras[era] : null);`. 
> 
> We also check against `eras.length` over `REIWA`/5 due to the possibility of additional eras via the property override or future eras in general.

Justin Lu has updated the pull request incrementally with one additional commit since the last revision:

  Naoto - correct comment regarding REIWA, add test case for IAE check w/ additional era via sys prop

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/23789/files
  - new: https://git.openjdk.org/jdk/pull/23789/files/f14d7c64..e55053aa

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=23789&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=23789&range=00-01

  Stats: 23 lines in 4 files changed: 17 ins; 0 del; 6 mod
  Patch: https://git.openjdk.org/jdk/pull/23789.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23789/head:pull/23789

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


More information about the core-libs-dev mailing list