commit-classpath
[Top][All Lists]
Advanced

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

[commit-cp] [bugs #9495] GregorianCalendar.getTimeInMillis() fails with


From: Andrew John Hughes
Subject: [commit-cp] [bugs #9495] GregorianCalendar.getTimeInMillis() fails with large millisecond values
Date: Sat, 15 Jan 2005 12:40:31 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Epiphany/1.0.8

This is an automated notification sent by Savannah.
It relates to:
                bugs #9495, project classpath

==============================================================================
 LATEST MODIFICATIONS of bugs #9495:
==============================================================================

               Posted by: Andrew John Hughes <gnu_andrew>
               Posted on: 2005-01-15 12:40 (GMT)
    _______________________________________________________

             Open/Closed:                    Open -> Closed                 

    _______________________________________________________

Follow-up Comment:
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.

==============================================================================
 OVERVIEW of bugs #9495:
==============================================================================

URL:
  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=9495>

                 Summary: GregorianCalendar.getTimeInMillis() fails with
large millisecond values
                 Project: classpath
            Submitted by: crawley
            Submitted on: Tue 06/29/2004 at 14:50
                Category: classpath
                Severity: 5 - Average
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Closed
        Platform Version: None

    _______________________________________________________


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.



    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Sat 01/15/2005 at 12:40       By: Andrew John Hughes <gnu_andrew>
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.








==============================================================================

This item URL is:
  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=9495>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

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