You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Mark Hindess (JIRA)" <ji...@apache.org> on 2006/05/23 15:10:29 UTC
[jira] Created: (HARMONY-498) GregorianCalendar clone problem
GregorianCalendar clone problem
-------------------------------
Key: HARMONY-498
URL: http://issues.apache.org/jira/browse/HARMONY-498
Project: Harmony
Type: Bug
Components: Classlib
Reporter: Mark Hindess
Priority: Minor
The following test code breaks on Harmony. Setting milliseconds to zero alters the day of the month. Output on RI is:
today time = Tue May 23 14:06:51 BST 2006
yesterday time = Mon May 22 14:06:51 BST 2006
day of month before resetting milliseconds = 23
day of month after resetting milliseconds = 23
time before resetting seconds = Tue May 23 14:06:51 BST 2006
time after resetting seconds = Tue May 23 14:06:00 BST 2006
Output on Harmony is:
today time = Tue May 23 13:59:39 BST 2006
yesterday time = Mon May 22 13:59:39 BST 2006
day of month before resetting milliseconds = 23
day of month after resetting milliseconds = 22
time before resetting seconds = Tue May 23 13:59:39 BST 2006
time after resetting seconds = Mon May 22 13:59:00 BST 2006
I suspect it might have something to do with the cachedFields?
import java.util.TimeZone;
import java.util.Calendar;
public class Test2 {
public static void main(String[] args) {
Calendar today = Calendar.getInstance();
System.err.println("today time = "+today.getTime());
Calendar yesterday = (Calendar)today.clone(); // copy not deep enough?
yesterday.add(Calendar.DATE, -1);
System.err.println("yesterday time = "+yesterday.getTime());
Calendar broken = (Calendar)today.clone();
System.err.println("day of month before resetting milliseconds = "+
broken.get(Calendar.DAY_OF_MONTH));
broken.set(Calendar.MILLISECOND, 0);
System.err.println("day of month after resetting milliseconds = "+
broken.get(Calendar.DAY_OF_MONTH));
System.err.println("time before resetting seconds = "+broken.getTime());
broken.set(Calendar.SECOND, 0);
System.err.println("time after resetting seconds = "+broken.getTime());
}
}
--
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] Closed: (HARMONY-498) GregorianCalendar clone problem
Posted by "Stepan Mishura (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-498?page=all ]
Stepan Mishura closed HARMONY-498:
----------------------------------
Verified by Mark.
> GregorianCalendar clone problem
> -------------------------------
>
> Key: HARMONY-498
> URL: http://issues.apache.org/jira/browse/HARMONY-498
> Project: Harmony
> Type: Bug
> Components: Classlib
> Reporter: Mark Hindess
> Assignee: Stepan Mishura
> Priority: Minor
>
> The following test code breaks on Harmony. Setting milliseconds to zero alters the day of the month. Output on RI is:
> today time = Tue May 23 14:06:51 BST 2006
> yesterday time = Mon May 22 14:06:51 BST 2006
> day of month before resetting milliseconds = 23
> day of month after resetting milliseconds = 23
> time before resetting seconds = Tue May 23 14:06:51 BST 2006
> time after resetting seconds = Tue May 23 14:06:00 BST 2006
> Output on Harmony is:
> today time = Tue May 23 13:59:39 BST 2006
> yesterday time = Mon May 22 13:59:39 BST 2006
> day of month before resetting milliseconds = 23
> day of month after resetting milliseconds = 22
> time before resetting seconds = Tue May 23 13:59:39 BST 2006
> time after resetting seconds = Mon May 22 13:59:00 BST 2006
> I suspect it might have something to do with the cachedFields?
> import java.util.TimeZone;
> import java.util.Calendar;
> public class Test2 {
> public static void main(String[] args) {
> Calendar today = Calendar.getInstance();
> System.err.println("today time = "+today.getTime());
> Calendar yesterday = (Calendar)today.clone(); // copy not deep enough?
> yesterday.add(Calendar.DATE, -1);
> System.err.println("yesterday time = "+yesterday.getTime());
> Calendar broken = (Calendar)today.clone();
> System.err.println("day of month before resetting milliseconds = "+
> broken.get(Calendar.DAY_OF_MONTH));
> broken.set(Calendar.MILLISECOND, 0);
> System.err.println("day of month after resetting milliseconds = "+
> broken.get(Calendar.DAY_OF_MONTH));
> System.err.println("time before resetting seconds = "+broken.getTime());
> broken.set(Calendar.SECOND, 0);
> System.err.println("time after resetting seconds = "+broken.getTime());
> }
> }
--
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-498) GregorianCalendar clone problem
Posted by "Mark Hindess (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-498?page=comments#action_12413385 ]
Mark Hindess commented on HARMONY-498:
--------------------------------------
Looks good. Thanks Stepan.
> GregorianCalendar clone problem
> -------------------------------
>
> Key: HARMONY-498
> URL: http://issues.apache.org/jira/browse/HARMONY-498
> Project: Harmony
> Type: Bug
> Components: Classlib
> Reporter: Mark Hindess
> Assignee: Stepan Mishura
> Priority: Minor
>
> The following test code breaks on Harmony. Setting milliseconds to zero alters the day of the month. Output on RI is:
> today time = Tue May 23 14:06:51 BST 2006
> yesterday time = Mon May 22 14:06:51 BST 2006
> day of month before resetting milliseconds = 23
> day of month after resetting milliseconds = 23
> time before resetting seconds = Tue May 23 14:06:51 BST 2006
> time after resetting seconds = Tue May 23 14:06:00 BST 2006
> Output on Harmony is:
> today time = Tue May 23 13:59:39 BST 2006
> yesterday time = Mon May 22 13:59:39 BST 2006
> day of month before resetting milliseconds = 23
> day of month after resetting milliseconds = 22
> time before resetting seconds = Tue May 23 13:59:39 BST 2006
> time after resetting seconds = Mon May 22 13:59:00 BST 2006
> I suspect it might have something to do with the cachedFields?
> import java.util.TimeZone;
> import java.util.Calendar;
> public class Test2 {
> public static void main(String[] args) {
> Calendar today = Calendar.getInstance();
> System.err.println("today time = "+today.getTime());
> Calendar yesterday = (Calendar)today.clone(); // copy not deep enough?
> yesterday.add(Calendar.DATE, -1);
> System.err.println("yesterday time = "+yesterday.getTime());
> Calendar broken = (Calendar)today.clone();
> System.err.println("day of month before resetting milliseconds = "+
> broken.get(Calendar.DAY_OF_MONTH));
> broken.set(Calendar.MILLISECOND, 0);
> System.err.println("day of month after resetting milliseconds = "+
> broken.get(Calendar.DAY_OF_MONTH));
> System.err.println("time before resetting seconds = "+broken.getTime());
> broken.set(Calendar.SECOND, 0);
> System.err.println("time after resetting seconds = "+broken.getTime());
> }
> }
--
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-498) GregorianCalendar clone problem
Posted by "Stepan Mishura (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-498?page=all ]
Stepan Mishura reassigned HARMONY-498:
--------------------------------------
Assign To: Stepan Mishura
> GregorianCalendar clone problem
> -------------------------------
>
> Key: HARMONY-498
> URL: http://issues.apache.org/jira/browse/HARMONY-498
> Project: Harmony
> Type: Bug
> Components: Classlib
> Reporter: Mark Hindess
> Assignee: Stepan Mishura
> Priority: Minor
>
> The following test code breaks on Harmony. Setting milliseconds to zero alters the day of the month. Output on RI is:
> today time = Tue May 23 14:06:51 BST 2006
> yesterday time = Mon May 22 14:06:51 BST 2006
> day of month before resetting milliseconds = 23
> day of month after resetting milliseconds = 23
> time before resetting seconds = Tue May 23 14:06:51 BST 2006
> time after resetting seconds = Tue May 23 14:06:00 BST 2006
> Output on Harmony is:
> today time = Tue May 23 13:59:39 BST 2006
> yesterday time = Mon May 22 13:59:39 BST 2006
> day of month before resetting milliseconds = 23
> day of month after resetting milliseconds = 22
> time before resetting seconds = Tue May 23 13:59:39 BST 2006
> time after resetting seconds = Mon May 22 13:59:00 BST 2006
> I suspect it might have something to do with the cachedFields?
> import java.util.TimeZone;
> import java.util.Calendar;
> public class Test2 {
> public static void main(String[] args) {
> Calendar today = Calendar.getInstance();
> System.err.println("today time = "+today.getTime());
> Calendar yesterday = (Calendar)today.clone(); // copy not deep enough?
> yesterday.add(Calendar.DATE, -1);
> System.err.println("yesterday time = "+yesterday.getTime());
> Calendar broken = (Calendar)today.clone();
> System.err.println("day of month before resetting milliseconds = "+
> broken.get(Calendar.DAY_OF_MONTH));
> broken.set(Calendar.MILLISECOND, 0);
> System.err.println("day of month after resetting milliseconds = "+
> broken.get(Calendar.DAY_OF_MONTH));
> System.err.println("time before resetting seconds = "+broken.getTime());
> broken.set(Calendar.SECOND, 0);
> System.err.println("time after resetting seconds = "+broken.getTime());
> }
> }
--
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-498) GregorianCalendar clone problem
Posted by "Stepan Mishura (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-498?page=all ]
Stepan Mishura resolved HARMONY-498:
------------------------------------
Resolution: Fixed
Thanks Mark - bug was fixed in LUNI module at r409336.
Please check that the fix fully resolves your problem.
> GregorianCalendar clone problem
> -------------------------------
>
> Key: HARMONY-498
> URL: http://issues.apache.org/jira/browse/HARMONY-498
> Project: Harmony
> Type: Bug
> Components: Classlib
> Reporter: Mark Hindess
> Assignee: Stepan Mishura
> Priority: Minor
>
> The following test code breaks on Harmony. Setting milliseconds to zero alters the day of the month. Output on RI is:
> today time = Tue May 23 14:06:51 BST 2006
> yesterday time = Mon May 22 14:06:51 BST 2006
> day of month before resetting milliseconds = 23
> day of month after resetting milliseconds = 23
> time before resetting seconds = Tue May 23 14:06:51 BST 2006
> time after resetting seconds = Tue May 23 14:06:00 BST 2006
> Output on Harmony is:
> today time = Tue May 23 13:59:39 BST 2006
> yesterday time = Mon May 22 13:59:39 BST 2006
> day of month before resetting milliseconds = 23
> day of month after resetting milliseconds = 22
> time before resetting seconds = Tue May 23 13:59:39 BST 2006
> time after resetting seconds = Mon May 22 13:59:00 BST 2006
> I suspect it might have something to do with the cachedFields?
> import java.util.TimeZone;
> import java.util.Calendar;
> public class Test2 {
> public static void main(String[] args) {
> Calendar today = Calendar.getInstance();
> System.err.println("today time = "+today.getTime());
> Calendar yesterday = (Calendar)today.clone(); // copy not deep enough?
> yesterday.add(Calendar.DATE, -1);
> System.err.println("yesterday time = "+yesterday.getTime());
> Calendar broken = (Calendar)today.clone();
> System.err.println("day of month before resetting milliseconds = "+
> broken.get(Calendar.DAY_OF_MONTH));
> broken.set(Calendar.MILLISECOND, 0);
> System.err.println("day of month after resetting milliseconds = "+
> broken.get(Calendar.DAY_OF_MONTH));
> System.err.println("time before resetting seconds = "+broken.getTime());
> broken.set(Calendar.SECOND, 0);
> System.err.println("time after resetting seconds = "+broken.getTime());
> }
> }
--
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