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:15 UTC
[jira] Created: (HARMONY-998) java.util.Calendar: large hours,
minutes and seconds are handled incorrectly
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
[jira] Commented: (HARMONY-998) java.util.Calendar: large hours,
minutes and seconds are handled incorrectly
Posted by "Anton Luht (JIRA)" <ji...@apache.org>.
[ 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
[jira] Assigned: (HARMONY-998) java.util.Calendar: large hours,
minutes and seconds are handled incorrectly
Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-998?page=all ]
Paulex Yang reassigned HARMONY-998:
-----------------------------------
Assignee: Paulex Yang
> 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
[jira] Updated: (HARMONY-998) java.util.Calendar: large hours,
minutes and seconds are handled incorrectly
Posted by "Anton Luht (JIRA)" <ji...@apache.org>.
[ 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
[jira] Resolved: (HARMONY-998) java.util.Calendar: large hours,
minutes and seconds are handled incorrectly
Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
[ 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
[jira] Updated: (HARMONY-998) java.util.Calendar: large hours,
minutes and seconds are handled incorrectly
Posted by "Anton Luht (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-998?page=all ]
Anton Luht updated HARMONY-998:
-------------------------------
Attachment: patch.txt
JUnit test patch - sorry to omit it in the classlib 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
> 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