You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Paulex Yang (JIRA)" <ji...@apache.org> on 2006/07/28 10:11:15 UTC

[jira] Resolved: (HARMONY-998) java.util.Calendar: large hours, minutes and seconds are handled incorrectly

     [ http://issues.apache.org/jira/browse/HARMONY-998?page=all ]

Paulex Yang resolved HARMONY-998.
---------------------------------

    Resolution: Fixed

Anton,  patch applied at revision r426427, thanks a lot for this enhancement, please verify that the problem is fully fixed as you expected. It would be nice if you can merge the test code into the patch as regression.


> java.util.Calendar: large hours, minutes and seconds are handled incorrectly
> ----------------------------------------------------------------------------
>
>                 Key: HARMONY-998
>                 URL: http://issues.apache.org/jira/browse/HARMONY-998
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Windows XP Professional
>            Reporter: Anton Luht
>         Assigned To: Paulex Yang
>            Priority: Minor
>         Attachments: patch.txt
>
>
> svn = r426060, (Jul 27 2006), Windows/ia32/msvc 1310, debug build
> The following code:
> import java.util.*;
> public class Test  {
>   public static void main (String[] args) { 
>     Calendar cal = new GregorianCalendar();
>     cal.set(1900, 0, 0, 0, Integer.MAX_VALUE);                        
>     System.out.println(cal.getTime());
>   } 
> }           
> Prints in RI:
> Sun Jan 23 02:07:02 MSK 5983
> and in Harmony
> Sat Dec 30 23:59:13 MSK 1899
> That happens because in calculation of long value (millisecond) right side is int * int which can overflow. Casting int values to long solves this problem. Please see the patch attached.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira