Bug 22807 - GregorianCalendar.computeTime - month out of range
Summary: GregorianCalendar.computeTime - month out of range
Status: RESOLVED FIXED
Alias: None
Product: classpath
Classification: Unclassified
Component: classpath (show other bugs)
Version: unspecified
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-06 03:31 UTC by from-classpath
Modified: 2005-07-23 22:54 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description from-classpath 2004-12-06 03:31:14 UTC
Here's the original stack traces from running Apache Axis' tests using IKVM:
http://nagoya.apache.org/~dims/ikvm-report/test/encoding/PackageTests.html

See attached Test.java for stripped down test case.

Thanks,
dims
Comment 1 from-classpath 2005-01-13 22:43:50 UTC
The line causing your problem is:
 date.set(0,0,0); 

Note that the default calendar is the Gregorian one, which does not have a year zero (1 AD was the year after 1 BC). 

The date created by the JDK by date.set(0,0,0) is Dec 31, year 2; which is clearly a bug. 

The IllegalArgumentException is correct behavior, however the error message is misleading. That should be fixed.
Comment 2 from-classpath 2005-01-14 15:49:18 UTC
My previous comment is wrong, it seems. With leniency set, it should accept that date. Year zero works out to be year 1 BC, and "Jan 0" works out to be Dec 31 of the year before, thus the correct result *is* Dec 31, 2 BC.

This needs fixing.