harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Elena Sayapina (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-4372) [classlib][luni] GregorianCalendar.roll() works incorrectly around end of year if MinimalDaysInFirstWeek is 4
Date Fri, 06 Jul 2007 09:45:04 GMT
[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.


Mime
View raw message