United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6231579 : (cal) ArrayIndexOutOfBoundsException in BaseCalendar

Details
Type:
Bug
Submit Date:
2005-02-22
Status:
Closed
Updated Date:
2015-05-12
Project Name:
JDK
Resolved Date:
2005-03-27
Component:
core-libs
OS:
linux
Sub-Component:
java.util:i18n
CPU:
x86
Priority:
P2
Resolution:
Not an Issue
Affected Versions:
5.0u1
Fixed Versions:

Related Reports
Duplicate:
Relates:

Sub Tasks

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



Hardware and Software, Engineered to Work Together