|
Quick Lists
|
|
Bug ID:
|
4994273
|
|
Votes
|
0
|
|
Synopsis
|
Calendar class outputs exception on 02-29-2004 and 12-31-2004
|
|
Category
|
java:classes_util_i18n
|
|
Reported Against
|
tiger-beta2
|
|
Release Fixed
|
|
|
State
|
11-Closed,
Not a Defect,
bug
|
|
Priority:
|
2-High
|
|
Related Bugs
|
4401223
|
|
Submit Date
|
13-FEB-2004
|
|
Description
|
There seems regression in 1.5.0beta(b37) when we use the Calendar class.
Calendar instance outputs java.lang.IllegalArgumentException
on customer -29-2004 and 12-31-2004 in 1.5.0 and 1.3.1(_0X),
but it works well in 1.4.X.
To REPRODUCE:
(1) Compile the attched program(LeapYear.java)
(2) Set the date of your PC to 2-29-2004
(3) Launch "java LeapYear"
==> You will see the exception.
K:\temp>java LeapYear
java.lang.IllegalArgumentException: MONTH
at java.util.GregorianCalendar.computeTime(GregorianCalendar.java:2392)
at java.util.Calendar.updateTime(Calendar.java:2241)
at java.util.Calendar.complete(Calendar.java:1305)
at java.util.Calendar.get(Calendar.java:1088)
at LeapYear.main(LeapYear.java:13)
(4) Set the date of your PC to 12-31-2004
(5) Launch "java LeapYear"
==> You will see the same exception.
(6) Set the date of your PC to teh date other than 2/29 and 12/31
on leap year.
(7) Launch "java LeapYear"
==> You don't see the exception.
NOTE:
- This exception shows up on 2/29/2004, 12/31/2004 and same days on leapyear
in 1.5.0-beta2.
- The exception does not occur in 1.4.X.
So, thas seems regression.
CONFIGURATION :
OS : WindowsXP(SP1, Japanese)
JRE/JDK : 1.5.0-beta-b37(and 1.3.1)
K:\temp>java -version
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b37)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b37, mixed mode)
==============================================================================
|
|
Work Around
|
N/A
|
|
Evaluation
|
When resolving the given date, the Calendar picks up YEAR and MONTH. Since there's no DAY_OF_MONTH specified, it picks up the current DAY_OF_MONTH value in the Calendar object, which is 29. Since 2005 is a common year, it throws an exception in non-lenient.
The reason why 1.4.x doesn't throw an exception is because there was a bug in the field resolution. It produces March 1, 2005. But the normalization shouldn't be performed in non-lenient, which problem has been fixed in Tiger.
xxxxx@xxxxx 2004-02-13
|
|
Comments
|
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |