JDK-8080105 : GregorianCalendar crashes on setting time with ArrayIndexOutOfBoundsException
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 8u40
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_8
  • CPU: x86
  • Submitted: 2015-05-01
  • Updated: 2015-05-12
  • Resolved: 2015-05-12
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

A DESCRIPTION OF THE PROBLEM :
From time to time, calling setTime on a GregorianCalendar instance crashes for no apparent reason.

Calendar cal = new GregorianCalendar();
Date d = new Date();

cal.clear();
cal.set(year, month - 1, day);
d.setTime(cal.getTimeInMillis());
[...]

cal.setTime(d);


REGRESSION.  Last worked in version 7u76


ERROR MESSAGES/STACK TRACES THAT OCCUR :

Caused by: java.lang.ArrayIndexOutOfBoundsException: 16
	at sun.util.calendar.BaseCalendar.getCalendarDateFromFixedDate(BaseCalendar.java:453)
	at java.util.GregorianCalendar.computeFields(GregorianCalendar.java:2397)
	at java.util.GregorianCalendar.computeFields(GregorianCalendar.java:2312)
	at java.util.Calendar.setTimeInMillis(Calendar.java:1804)
	at java.util.Calendar.setTime(Calendar.java:1770)


REPRODUCIBILITY :
This bug can be reproduced occasionally.


Comments
No reliable reproducer. The symptoms look very close to JDK-6231579, so I'm closing this issue as a duplicate.
12-05-2015