[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug classpath/22756] GregorianCalendar.getTimeInMillis() fails with lar
From: |
gcc-bugzilla at gcc dot gnu dot org |
Subject: |
[Bug classpath/22756] GregorianCalendar.getTimeInMillis() fails with large millisecond values |
Date: |
16 Oct 2005 01:27:02 -0000 |
getTimeInMillis() converts large (magnitude) values to
year/month/day incorrectly. Typically, it miscalculates
the month as negative and throws IllegalArgumentException.
For example:
FAIL: gnu.testlet.java.util.GregorianCalendar.conversion: uncaught exception at
"Testing setTimeInMillis(281474976710656) i = 48" number 3
java.lang.IllegalArgumentException: month out of range
at java.util.SimpleTimeZone.getOffset (SimpleTimeZone.java:684)
at java.util.GregorianCalendar.computeFields (GregorianCalendar.java:610)
at java.util.Calendar.setTimeInMillis (Calendar.java:541)
at gnu.testlet.java.util.GregorianCalendar.conversion.testMonotonic1
(conversion.java:79)
at gnu.testlet.java.util.GregorianCalendar.conversion.test
(conversion.java:41)
at gnu.testlet.SimpleTestHarness.runtest (SimpleTestHarness.java:254)
at gnu.testlet.SimpleTestHarness.main (SimpleTestHarness.java:364)
The problem is that GregorianCalendar is doing some key
conversion calculations using 'int' instead of 'long', and
intermediate values are overflowing.
------- Comment #1 from from-classpath at savannah dot gnu dot org 2005-01-15
12:40 -------
testMonotonic1 passes with current Classpath CVS HEAD and JamVM, so
setTimeInMillis() can now handle all values up until Long.MAX_VALUE. I'm
closing this, unless someone can still see this bug with current CVS.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22756
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug classpath/22756] GregorianCalendar.getTimeInMillis() fails with large millisecond values,
gcc-bugzilla at gcc dot gnu dot org <=