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 11:45:04 UTC

[jira] Created: (HARMONY-4372) [classlib][luni] GregorianCalendar.roll() works incorrectly around end of year if MinimalDaysInFirstWeek is 4

[classlib][luni] GregorianCalendar.roll() works incorrectly around end of year if MinimalDaysInFirstWeek is 4
-------------------------------------------------------------------------------------------------------------

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


GregorianCalendar.roll() works incorrectly around end of year if MinimalDaysInFirstWeek is 4

Please, consider the following code:

import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Locale;

public class rollTest {

	static GregorianCalendar calendar = new GregorianCalendar(Locale.UK);
	static GregorianCalendar pattern = new GregorianCalendar(Locale.UK);
	
	public static void main(String[] args) {
	    calendar.set(1994, 11, 30, 0, 0, 0);
	    pattern.set(1994, 0, 7, 0, 0, 0);
	    System.out.println("MinimalDaysInFirstWeek: " + calendar.getMinimalDaysInFirstWeek());
	    System.out.println("Initial date: " + calendar.getTime());
	    calendar.roll(Calendar.WEEK_OF_YEAR, true);
	    System.out.println("Roll ahead by WEEK_OF_YEAR: " + calendar.getTime());
	    if (calendar.equals(pattern)) 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

MinimalDaysInFirstWeek: 4
Initial date: Fri Dec 30 00:00:00 NOVT 1994
Roll ahead by  WEEK_OF_YEAR: Sat Dec 31 00:00:00 NOVT 1994
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)

MinimalDaysInFirstWeek: 4
Initial date: Fri Dec 30 00:00:00 NOVT 1994
Roll ahead by WEEK_OF_YEAR: Fri Jan 07 00:00:00 NOVT 1994
TEST PASSED


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


[jira] Commented: (HARMONY-4372) [classlib][luni] GregorianCalendar.roll() works incorrectly around end of year if MinimalDaysInFirstWeek is 4

Posted by "Elena Sayapina (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4372?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12511410 ] 

Elena Sayapina commented on HARMONY-4372:
-----------------------------------------

Hello, Tony, 
The test from this bug passed on Harmony-r554868.

But I slightly changed the test, added roll back to initial date, and expected that it rolls back, but it didn't
Correct me if I missed something and please, see updated test:

import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Locale;

public class rollTest { 

	static GregorianCalendar calendar = new GregorianCalendar(Locale.UK); 
	static GregorianCalendar pattern = new GregorianCalendar(Locale.UK); 

	public static void main(String[] args) { 
		calendar.set(1994, 11, 30, 0, 0, 0); 
		pattern.set(1994, 11, 30, 0, 0, 0); 
		System.out.println("MinimalDaysInFirstWeek: " + calendar.getMinimalDaysInFirstWeek()); 
		System.out.println("Initial date: " + calendar.getTime()); 
		calendar.roll(Calendar.WEEK_OF_YEAR, true); 
		System.out.println("Roll ahead by WEEK_OF_YEAR: " + calendar.getTime()); 
		calendar.roll(Calendar.WEEK_OF_YEAR, false); 
		System.out.println("Roll back by WEEK_OF_YEAR: " + calendar.getTime()); 
		if (calendar.equals(pattern)) System.out.println("TEST PASSED"); 
		else System.out.println("TEST FAILED"); 
	} 
} 

Output on Harmony-r554868:
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 = r554868, (Jul 10 2007), Windows/ia32/msvc 1310, release build
http://harmony.apache.org

MinimalDaysInFirstWeek: 4
Initial date: Fri Dec 30 00:00:00 NOVT 1994
Roll ahead by WEEK_OF_YEAR: Fri Jan 07 00:00:00 NOVT 1994
Roll back by WEEK_OF_YEAR: Fri Jan 07 00:00:00 NOVT 1994
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)

MinimalDaysInFirstWeek: 4
Initial date: Fri Dec 30 00:00:00 NOVT 1994
Roll ahead by WEEK_OF_YEAR: Fri Jan 07 00:00:00 NOVT 1994
Roll back by WEEK_OF_YEAR: Fri Dec 30 00:00:00 NOVT 1994
TEST PASSED


> [classlib][luni] GregorianCalendar.roll() works incorrectly around end of year if MinimalDaysInFirstWeek is 4
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4372
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4372
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Elena Sayapina
>            Assignee: Tony Wu
>            Priority: Minor
>
> GregorianCalendar.roll() works incorrectly around end of year if MinimalDaysInFirstWeek is 4
> Please, consider the following code:
> import java.util.Calendar;
> import java.util.GregorianCalendar;
> import java.util.Locale;
> public class rollTest {
> 	static GregorianCalendar calendar = new GregorianCalendar(Locale.UK);
> 	static GregorianCalendar pattern = new GregorianCalendar(Locale.UK);
> 	
> 	public static void main(String[] args) {
> 	    calendar.set(1994, 11, 30, 0, 0, 0);
> 	    pattern.set(1994, 0, 7, 0, 0, 0);
> 	    System.out.println("MinimalDaysInFirstWeek: " + calendar.getMinimalDaysInFirstWeek());
> 	    System.out.println("Initial date: " + calendar.getTime());
> 	    calendar.roll(Calendar.WEEK_OF_YEAR, true);
> 	    System.out.println("Roll ahead by WEEK_OF_YEAR: " + calendar.getTime());
> 	    if (calendar.equals(pattern)) 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
> MinimalDaysInFirstWeek: 4
> Initial date: Fri Dec 30 00:00:00 NOVT 1994
> Roll ahead by  WEEK_OF_YEAR: Sat Dec 31 00:00:00 NOVT 1994
> 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)
> MinimalDaysInFirstWeek: 4
> Initial date: Fri Dec 30 00:00:00 NOVT 1994
> Roll ahead by WEEK_OF_YEAR: Fri Jan 07 00:00:00 NOVT 1994
> TEST PASSED

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


[jira] Reopened: (HARMONY-4372) [classlib][luni] GregorianCalendar.roll() works incorrectly around end of year if MinimalDaysInFirstWeek is 4

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

Elena Sayapina reopened HARMONY-4372:
-------------------------------------


> [classlib][luni] GregorianCalendar.roll() works incorrectly around end of year if MinimalDaysInFirstWeek is 4
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4372
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4372
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Elena Sayapina
>            Assignee: Tony Wu
>            Priority: Minor
>
> GregorianCalendar.roll() works incorrectly around end of year if MinimalDaysInFirstWeek is 4
> Please, consider the following code:
> import java.util.Calendar;
> import java.util.GregorianCalendar;
> import java.util.Locale;
> public class rollTest {
> 	static GregorianCalendar calendar = new GregorianCalendar(Locale.UK);
> 	static GregorianCalendar pattern = new GregorianCalendar(Locale.UK);
> 	
> 	public static void main(String[] args) {
> 	    calendar.set(1994, 11, 30, 0, 0, 0);
> 	    pattern.set(1994, 0, 7, 0, 0, 0);
> 	    System.out.println("MinimalDaysInFirstWeek: " + calendar.getMinimalDaysInFirstWeek());
> 	    System.out.println("Initial date: " + calendar.getTime());
> 	    calendar.roll(Calendar.WEEK_OF_YEAR, true);
> 	    System.out.println("Roll ahead by WEEK_OF_YEAR: " + calendar.getTime());
> 	    if (calendar.equals(pattern)) 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
> MinimalDaysInFirstWeek: 4
> Initial date: Fri Dec 30 00:00:00 NOVT 1994
> Roll ahead by  WEEK_OF_YEAR: Sat Dec 31 00:00:00 NOVT 1994
> 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)
> MinimalDaysInFirstWeek: 4
> Initial date: Fri Dec 30 00:00:00 NOVT 1994
> Roll ahead by WEEK_OF_YEAR: Fri Jan 07 00:00:00 NOVT 1994
> 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-4372) [classlib][luni] GregorianCalendar.roll() works incorrectly around end of year if MinimalDaysInFirstWeek is 4

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

Tony Wu reassigned HARMONY-4372:
--------------------------------

    Assignee: Tony Wu

> [classlib][luni] GregorianCalendar.roll() works incorrectly around end of year if MinimalDaysInFirstWeek is 4
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4372
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4372
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Elena Sayapina
>            Assignee: Tony Wu
>            Priority: Minor
>
> GregorianCalendar.roll() works incorrectly around end of year if MinimalDaysInFirstWeek is 4
> Please, consider the following code:
> import java.util.Calendar;
> import java.util.GregorianCalendar;
> import java.util.Locale;
> public class rollTest {
> 	static GregorianCalendar calendar = new GregorianCalendar(Locale.UK);
> 	static GregorianCalendar pattern = new GregorianCalendar(Locale.UK);
> 	
> 	public static void main(String[] args) {
> 	    calendar.set(1994, 11, 30, 0, 0, 0);
> 	    pattern.set(1994, 0, 7, 0, 0, 0);
> 	    System.out.println("MinimalDaysInFirstWeek: " + calendar.getMinimalDaysInFirstWeek());
> 	    System.out.println("Initial date: " + calendar.getTime());
> 	    calendar.roll(Calendar.WEEK_OF_YEAR, true);
> 	    System.out.println("Roll ahead by WEEK_OF_YEAR: " + calendar.getTime());
> 	    if (calendar.equals(pattern)) 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
> MinimalDaysInFirstWeek: 4
> Initial date: Fri Dec 30 00:00:00 NOVT 1994
> Roll ahead by  WEEK_OF_YEAR: Sat Dec 31 00:00:00 NOVT 1994
> 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)
> MinimalDaysInFirstWeek: 4
> Initial date: Fri Dec 30 00:00:00 NOVT 1994
> Roll ahead by WEEK_OF_YEAR: Fri Jan 07 00:00:00 NOVT 1994
> 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-4372) [classlib][luni] GregorianCalendar.roll() works incorrectly around end of year if MinimalDaysInFirstWeek is 4

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

Tony Wu resolved HARMONY-4372.
------------------------------

    Resolution: Fixed

Fixed at r554942, Thanks Elena.
Please verify if the backward operation works well.

> [classlib][luni] GregorianCalendar.roll() works incorrectly around end of year if MinimalDaysInFirstWeek is 4
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4372
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4372
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Elena Sayapina
>            Assignee: Tony Wu
>            Priority: Minor
>
> GregorianCalendar.roll() works incorrectly around end of year if MinimalDaysInFirstWeek is 4
> Please, consider the following code:
> import java.util.Calendar;
> import java.util.GregorianCalendar;
> import java.util.Locale;
> public class rollTest {
> 	static GregorianCalendar calendar = new GregorianCalendar(Locale.UK);
> 	static GregorianCalendar pattern = new GregorianCalendar(Locale.UK);
> 	
> 	public static void main(String[] args) {
> 	    calendar.set(1994, 11, 30, 0, 0, 0);
> 	    pattern.set(1994, 0, 7, 0, 0, 0);
> 	    System.out.println("MinimalDaysInFirstWeek: " + calendar.getMinimalDaysInFirstWeek());
> 	    System.out.println("Initial date: " + calendar.getTime());
> 	    calendar.roll(Calendar.WEEK_OF_YEAR, true);
> 	    System.out.println("Roll ahead by WEEK_OF_YEAR: " + calendar.getTime());
> 	    if (calendar.equals(pattern)) 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
> MinimalDaysInFirstWeek: 4
> Initial date: Fri Dec 30 00:00:00 NOVT 1994
> Roll ahead by  WEEK_OF_YEAR: Sat Dec 31 00:00:00 NOVT 1994
> 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)
> MinimalDaysInFirstWeek: 4
> Initial date: Fri Dec 30 00:00:00 NOVT 1994
> Roll ahead by WEEK_OF_YEAR: Fri Jan 07 00:00:00 NOVT 1994
> 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-4372) [classlib][luni] GregorianCalendar.roll() works incorrectly around end of year if MinimalDaysInFirstWeek is 4

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

Tony Wu resolved HARMONY-4372.
------------------------------

    Resolution: Fixed

Hi Elena,
Bug fixed at r554597, please verify if it fixed as you expected. Thanks

> [classlib][luni] GregorianCalendar.roll() works incorrectly around end of year if MinimalDaysInFirstWeek is 4
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4372
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4372
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Elena Sayapina
>            Assignee: Tony Wu
>            Priority: Minor
>
> GregorianCalendar.roll() works incorrectly around end of year if MinimalDaysInFirstWeek is 4
> Please, consider the following code:
> import java.util.Calendar;
> import java.util.GregorianCalendar;
> import java.util.Locale;
> public class rollTest {
> 	static GregorianCalendar calendar = new GregorianCalendar(Locale.UK);
> 	static GregorianCalendar pattern = new GregorianCalendar(Locale.UK);
> 	
> 	public static void main(String[] args) {
> 	    calendar.set(1994, 11, 30, 0, 0, 0);
> 	    pattern.set(1994, 0, 7, 0, 0, 0);
> 	    System.out.println("MinimalDaysInFirstWeek: " + calendar.getMinimalDaysInFirstWeek());
> 	    System.out.println("Initial date: " + calendar.getTime());
> 	    calendar.roll(Calendar.WEEK_OF_YEAR, true);
> 	    System.out.println("Roll ahead by WEEK_OF_YEAR: " + calendar.getTime());
> 	    if (calendar.equals(pattern)) 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
> MinimalDaysInFirstWeek: 4
> Initial date: Fri Dec 30 00:00:00 NOVT 1994
> Roll ahead by  WEEK_OF_YEAR: Sat Dec 31 00:00:00 NOVT 1994
> 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)
> MinimalDaysInFirstWeek: 4
> Initial date: Fri Dec 30 00:00:00 NOVT 1994
> Roll ahead by WEEK_OF_YEAR: Fri Jan 07 00:00:00 NOVT 1994
> TEST PASSED

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