-
Bug
-
Resolution: Fixed
-
P3
-
8u271, 11.0.13, 16.0.2, 18
-
b16
-
generic
-
generic
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8274246 | 17.0.2 | Yoshiki Sato | P3 | Resolved | Fixed | b01 |
JDK-8274247 | 11.0.14-oracle | Yoshiki Sato | P3 | Resolved | Fixed | b01 |
JDK-8274831 | 11.0.14 | Martin Doerr | P3 | Resolved | Fixed | b01 |
JDK-8274248 | 8u321 | Yoshiki Sato | P3 | Resolved | Fixed | b01 |
X = 1- ((Calendar.MONTH+1) + amount), and if X is a multiple of 12, AIOOBE is thrown.
The reproducer is below:
jshell> var calendar = Calendar.getInstance(new Locale("ja", "JP", "JP"))
calendar ==> java.util.JapaneseImperialCalendar[time=163184924 ...
SET=32400000,DST_OFFSET=0]
jshell> var month = 2
month ==> 2
jshell> var amount = -14
amount ==> -14
jshell> calendar.set(2, month, 1, 1, 0)
jshell> calendar.add(Calendar.MONTH, amount)
| 例外java.lang.ArrayIndexOutOfBoundsException: Index 13 out of bounds for
length 13
| at BaseCalendar.getDayOfYear (BaseCalendar.java:348)
| at BaseCalendar.getFixedDate (BaseCalendar.java:381)
| at BaseCalendar.getFixedDate (BaseCalendar.java:356)
| at AbstractCalendar.getTime (AbstractCalendar.java:175)
| at BaseCalendar.normalize (BaseCalendar.java:228)
| at LocalGregorianCalendar.normalize
(LocalGregorianCalendar.java:328)
| at JapaneseImperialCalendar.pinDayOfMonth
(JapaneseImperialCalendar.java:2288)
| at JapaneseImperialCalendar.add (JapaneseImperialCalendar.java:452)
| at (#5:1)
In this reproducer, X=1-((2+1)+(-14)) = 12. In this case, AIOOBE is thrown.
The issue is reproduced in 18, 16.0.2, 11.0.13 and 8u311.
- backported by
-
JDK-8274246 ArrayIndexOutOfBoundsException thrown in java.util.JapaneseImperialCalendar.add()
- Resolved
-
JDK-8274247 ArrayIndexOutOfBoundsException thrown in java.util.JapaneseImperialCalendar.add()
- Resolved
-
JDK-8274248 ArrayIndexOutOfBoundsException thrown in java.util.JapaneseImperialCalendar.add()
- Resolved
-
JDK-8274831 ArrayIndexOutOfBoundsException thrown in java.util.JapaneseImperialCalendar.add()
- Resolved
- links to
-
Commit openjdk/jdk11u-dev/58fe5e84
-
Commit openjdk/jdk17u/c4b3d62c
-
Commit openjdk/jdk/d39aad92
-
Review openjdk/jdk11u-dev/472
-
Review openjdk/jdk17u/113
-
Review openjdk/jdk/5611