FULL PRODUCT VERSION :
Java 1.5.0_3
ADDITIONAL OS VERSION INFORMATION :
Windows 2000 Server, Latest service packs/Window's Updates.
A DESCRIPTION OF THE PROBLEM :
The following code is executed perhaps a half-a-million times a day, but when the load on the server is heavy (say 15x / second), it occasionally bumps with an exception:
public static String getRFC822Date(Date d) {
SimpleDateFormat df = new SimpleDateFormat("EE, dd MMM yyyy HH:mm:ss zz");
String s = "";
try {
df.setTimeZone(TimeZone.getTimeZone("GMT"));
s = RFC822DateFormat.format(d);
}
catch (Exception e) {
System.err.println("getRFC822Date(" + d + ") failed. " + e);
}
return s;
}
Exception examples:
17/Jun/2005:16:01:36 -0500 getRFC822Date(Fri Jun 17 16:01:36 CDT 2005) failed. java.lang.ArrayIndexOutOfBoundsException: -2147483648
20/Jun/2005:17:45:03 -0500 getRFC822Date(Mon Jun 20 17:45:03 CDT 2005) failed. java.lang.ArrayIndexOutOfBoundsException: -2147483648
21/Jun/2005:09:29:43 -0500 getRFC822Date(Tue Jun 21 09:29:43 CDT 2005) failed. java.lang.ArrayIndexOutOfBoundsException: -2147483648
22/Jun/2005:07:57:49 -0500 getRFC822Date(Wed Jun 22 07:57:49 CDT 2005) failed. java.lang.ArrayIndexOutOfBoundsException: -2147483648
22/Jun/2005:09:25:34 -0500 getRFC822Date(Wed Jun 22 09:25:34 CDT 2005) failed. java.lang.ArrayIndexOutOfBoundsException: -2147483648
A related case seems to be the lastModified() call in java.io.File.
Again, this doesn't happen on every pass. The server can handle an average load of about 5 calls / second, but I start see this error pop up about twice a day, at peak usage, which perhaps exceeds 15 calls / second.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run above code under heavy load.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No exception
ACTUAL -
Every now and then, the exception is thrown.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
See above.
17/Jun/2005:16:01:36 -0500 getRFC822Date(Fri Jun 17 16:01:36 CDT 2005) failed. java.lang.ArrayIndexOutOfBoundsException: -2147483648
REPRODUCIBILITY :
This bug can be reproduced occasionally.
---------- BEGIN SOURCE ----------
public static String getRFC822Date(Date d) {
SimpleDateFormat df = new SimpleDateFormat("EE, dd MMM yyyy HH:mm:ss zz");
String s = "";
try {
df.setTimeZone(TimeZone.getTimeZone("GMT"));
s = RFC822DateFormat.format(d);
}
catch (Exception e) {
System.err.println("getRFC822Date(" + d + ") failed. " + e);
}
return s;
}
---------- END SOURCE ----------
###@###.### 2005-07-12 09:56:52 GMT