[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bugs #9495] GregorianCalendar.getTimeInMillis() fails with large millis

From: Stephen Crawley
Subject: [bugs #9495] GregorianCalendar.getTimeInMillis() fails with large millisecond values
Date: Tue, 29 Jun 2004 10:52:40 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225

This mail is an automated notification from the bugs tracker
 of the project: classpath.

[bugs #9495] Full Item Snapshot:

URL: <>
Project: classpath
Submitted by: Stephen Crawley
On: Tue 06/29/2004 at 14:50

Severity:  5 - Average
Resolution:  None
Assigned to:  None
Status:  Open
Platform Version:  None

Summary:  GregorianCalendar.getTimeInMillis() fails with large millisecond 

Original Submission:  getTimeInMillis() converts large (magnitude) values to
year/month/day incorrectly.  Typically, it miscalculates
the month as negative and throws IllegalArgumentException.
For example:

FAIL: uncaught exception at 
"Testing setTimeInMillis(281474976710656) i = 48" number 3
java.lang.IllegalArgumentException: month out of range
   at java.util.SimpleTimeZone.getOffset (
   at java.util.GregorianCalendar.computeFields (
   at java.util.Calendar.setTimeInMillis (
   at gnu.testlet.SimpleTestHarness.runtest (
   at gnu.testlet.SimpleTestHarness.main (

The problem is that GregorianCalendar is doing some key
conversion calculations using 'int' instead of 'long', and
intermediate values are overflowing.

For detailed info, follow this link:

  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]