You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Elena Sayapina (JIRA)" <ji...@apache.org> on 2007/07/06 14:24:05 UTC

[jira] Created: (HARMONY-4384) [classlib][luni] Losing Calendar.set(...) settings during consecutive set(...) calls

[classlib][luni] Losing Calendar.set(...) settings during consecutive set(...) calls 
-------------------------------------------------------------------------------------

                 Key: HARMONY-4384
                 URL: https://issues.apache.org/jira/browse/HARMONY-4384
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Elena Sayapina
            Priority: Minor


Sometimes during consecutive calls to Calendar.set(...) these settings are lost (don't affect calendar's time value) 
like in the test below setting DAY_OF_WEEK to MONDAY has no effect to calendar's day of week

Also note that calling calendar.clear() somehow affect this behavior, 
Because, if comment this string or call calendar.getTime()) after it, then the test passes 

Please, consider the following code:

import java.util.Calendar;

public class setTest {

	public static void main(String[] args) {
	    Calendar calendar = Calendar.getInstance();
	    calendar.clear();
	    calendar.set(Calendar.YEAR, 2007);
	    calendar.set(Calendar.MONTH, 7);
	    calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
	    System.out.println(calendar.getTime());
	    if (calendar.get(Calendar.DAY_OF_WEEK) == 2) System.out.println("TEST PASSED");
	    else System.out.println("TEST FAILED");
	}
}

Output on Harmony-r553727:

Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors,
as applicable.
java version "1.5.0"
pre-alpha : not complete or compatible
svn = r553727, (Jul  6 2007), Windows/ia32/msvc 1310, release build
http://harmony.apache.org
Wed Aug 01 00:00:00 NOVST 2007
TEST FAILED

Output on RI:

java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode)

Mon Aug 06 00:00:00 NOVST 2007
TEST PASSED


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (HARMONY-4384) [classlib][luni] Losing Calendar.set(...) settings during consecutive set(...) calls

Posted by "Tony Wu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4384?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tony Wu resolved HARMONY-4384.
------------------------------

    Resolution: Fixed

Hi Elena,

Fixed at r554847,  please verify if it fixed as you expected. thanks.

> [classlib][luni] Losing Calendar.set(...) settings during consecutive set(...) calls 
> -------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4384
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4384
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Elena Sayapina
>            Assignee: Tony Wu
>            Priority: Minor
>
> Sometimes during consecutive calls to Calendar.set(...) these settings are lost (don't affect calendar's time value) 
> like in the test below setting DAY_OF_WEEK to MONDAY has no effect to calendar's day of week
> Also note that calling calendar.clear() somehow affect this behavior, 
> Because, if comment this string or call calendar.getTime()) after it, then the test passes 
> Please, consider the following code:
> import java.util.Calendar;
> public class setTest {
> 	public static void main(String[] args) {
> 	    Calendar calendar = Calendar.getInstance();
> 	    calendar.clear();
> 	    calendar.set(Calendar.YEAR, 2007);
> 	    calendar.set(Calendar.MONTH, 7);
> 	    calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
> 	    System.out.println(calendar.getTime());
> 	    if (calendar.get(Calendar.DAY_OF_WEEK) == 2) System.out.println("TEST PASSED");
> 	    else System.out.println("TEST FAILED");
> 	}
> }
> Output on Harmony-r553727:
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors,
> as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r553727, (Jul  6 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> Wed Aug 01 00:00:00 NOVST 2007
> TEST FAILED
> Output on RI:
> java version "1.5.0_11"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode)
> Mon Aug 06 00:00:00 NOVST 2007
> TEST PASSED

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (HARMONY-4384) [classlib][luni] Losing Calendar.set(...) settings during consecutive set(...) calls

Posted by "Tony Wu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4384?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tony Wu reassigned HARMONY-4384:
--------------------------------

    Assignee: Tony Wu

> [classlib][luni] Losing Calendar.set(...) settings during consecutive set(...) calls 
> -------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4384
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4384
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Elena Sayapina
>            Assignee: Tony Wu
>            Priority: Minor
>
> Sometimes during consecutive calls to Calendar.set(...) these settings are lost (don't affect calendar's time value) 
> like in the test below setting DAY_OF_WEEK to MONDAY has no effect to calendar's day of week
> Also note that calling calendar.clear() somehow affect this behavior, 
> Because, if comment this string or call calendar.getTime()) after it, then the test passes 
> Please, consider the following code:
> import java.util.Calendar;
> public class setTest {
> 	public static void main(String[] args) {
> 	    Calendar calendar = Calendar.getInstance();
> 	    calendar.clear();
> 	    calendar.set(Calendar.YEAR, 2007);
> 	    calendar.set(Calendar.MONTH, 7);
> 	    calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
> 	    System.out.println(calendar.getTime());
> 	    if (calendar.get(Calendar.DAY_OF_WEEK) == 2) System.out.println("TEST PASSED");
> 	    else System.out.println("TEST FAILED");
> 	}
> }
> Output on Harmony-r553727:
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors,
> as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r553727, (Jul  6 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> Wed Aug 01 00:00:00 NOVST 2007
> TEST FAILED
> Output on RI:
> java version "1.5.0_11"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode)
> Mon Aug 06 00:00:00 NOVST 2007
> TEST PASSED

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.