harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anton Luht (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-998) java.util.Calendar: large hours, minutes and seconds are handled incorrectly
Date Fri, 28 Jul 2006 11:45:15 GMT
    [ http://issues.apache.org/jira/browse/HARMONY-998?page=comments#action_12424073 ] 
            
Anton Luht commented on HARMONY-998:
------------------------------------

verified on 
svn = r426480, (Jul 28 2006), Windows/ia32/msvc 1310, debug build

> 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, 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

        

Mime
View raw message