<i18n dev> RFR: 8350646: Calendar.Builder.build() Throws ArrayIndexOutOfBoundsException [v2]
Naoto Sato
naoto at openjdk.org
Wed Feb 26 19:25:53 UTC 2025
On Wed, 26 Feb 2025 18:26:15 GMT, Justin Lu <jlu at openjdk.org> wrote:
>> 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
test/jdk/java/util/Calendar/SupplementalJapaneseEraTest.java line 75:
> 73: new Calendar.Builder()
> 74: .setCalendarType("japanese")
> 75: .setFields(ERA, 7)
Sorry I suggested this immediate value "7", but this can be `JapaneseEra.values().length + 2` which might be more meaningful
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23789#discussion_r1972249833
More information about the i18n-dev
mailing list