JDK-6231579 : (cal) ArrayIndexOutOfBoundsException in BaseCalendar
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 5.0u1
  • Priority: P2
  • Status: Closed
  • Resolution: Not an Issue
  • OS: linux
  • CPU: x86
  • Submitted: 2005-02-22
  • Updated: 2015-05-12
  • Resolved: 2005-03-27
Related Reports
Duplicate :  
Relates :  
Description
Getting the following exceptions after we moving on to jdk1.5.0_01 :  
 
java.lang.ArrayIndexOutOfBoundsException: 432
        at sun.util.calendar.BaseCalendar.getCalendarDateFromFixedDate(BaseCalendar.java:436)
        at java.util.GregorianCalendar.computeFields(GregorianCalendar.java:2024)
        at java.util.GregorianCalendar.computeFields(GregorianCalendar.java:1941)
        at java.util.Calendar.setTimeInMillis(Calendar.java:1066)
        at java.util.Calendar.setTime(Calendar.java:1032)
        at java.text.SimpleDateFormat.format(SimpleDateFormat.java:785)
        at java.text.SimpleDateFormat.format(SimpleDateFormat.java:778)
        at java.text.DateFormat.format(DateFormat.java:314)
        at com.partypoker.common.Debug.formatTime(Debug.java:178)
 
The relevant code snippet in Debug.java at which the above exception happened  : 
==================================================================
    static java.text.SimpleDateFormat tf = new java.text.SimpleDateFormat("HH-mm-ss");
    ....
    public static String formatTime(long t) {
        return tf.format(new Date(t));
    }
==================================================================
 
System details : 
    Jdk version   : jdk1.5.0_01 
    Operating System  : Redhat Enterprise Linux 3.0 - Enterprise Server
    OS version   : 2.4.20-24.7smp
    Hardware platform  : Compaq DL360 G3
###@###.### 2005-2-22 11:02:59 GMT

Comments
EVALUATION Is the class method formatTime called by multiple threads without synchronization? ###@###.### 2005-2-23 04:41:58 GMT Calendar methods are called by multiple threads through a SimpleDateFormat, which corrupted cache data and caused the exception. As stated in the SimpleDateFormat documentation, SimpleDateFormat isn't thread-safe. Please make sure to use synchronization to share a SimpleDateFormat by threads. ###@###.### 2005-03-27 13:54:21 GMT
2005-02-23