You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Anton Luht (JIRA)" <ji...@apache.org> on 2006/07/27 17:06:16 UTC
[jira] Updated: (HARMONY-998) java.util.Calendar: large hours,
minutes and seconds are handled incorrectly
[ http://issues.apache.org/jira/browse/HARMONY-998?page=all ]
Anton Luht updated HARMONY-998:
-------------------------------
Attachment: patch.txt
patch
> 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
> 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