FULL PRODUCT VERSION :
E:\workspace\oXygen>java -version
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
The problem appeared first in Jing, with Java 1.5 it does not validate date values anymore. Tracing it down it appear to be caused by an java.lang.IllegalArgumentException thrown at at java.util.GregorianCalendar.computeTime(GregorianCalendar.java:2431).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the class entered in the "Source code for an executable test case" entry.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The calendar time, for instance:
Tue Feb 03 02:00:00 EET 2004
ACTUAL -
Exception in thread "main" java.lang.IllegalArgumentException: HOUR_OF_DAY
at java.util.GregorianCalendar.computeTime(GregorianCalendar.java:2431)
at java.util.Calendar.updateTime(Calendar.java:2260)
at java.util.Calendar.getTimeInMillis(Calendar.java:1044)
at java.util.Calendar.getTime(Calendar.java:1017)
at GregorianCalendarProblem.main(GregorianCalendarProblem.java:72)
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.IllegalArgumentException: HOUR_OF_DAY
at java.util.GregorianCalendar.computeTime(GregorianCalendar.java:2431)
at java.util.Calendar.updateTime(Calendar.java:2260)
at java.util.Calendar.getTimeInMillis(Calendar.java:1044)
at java.util.Calendar.getTime(Calendar.java:1017)
at GregorianCalendarProblem.main(GregorianCalendarProblem.java:72)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
/**
* @author george
*/
public class GregorianCalendarProblem {
public static void main(String[] args) {
GregorianCalendar cal = new GregorianCalendar();
cal.setLenient(false);
cal.setGregorianChange(new Date(Long.MIN_VALUE));
cal.clear();
cal.set(Calendar.ZONE_OFFSET, 0);
cal.set(Calendar.DST_OFFSET, 0);
cal.set(Calendar.ERA, GregorianCalendar.AD);
cal.set(2004, 1, 3, 0, 0, 0);
cal.set(Calendar.MILLISECOND, 0);
System.out.println(cal.getTime());
}
}
---------- END SOURCE ----------
###@###.### 2005-2-22 12:13:45 GMT