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-4384) [classlib][luni] Losing Calendar.set(...) settings during consecutive set(...) calls
Date Fri, 06 Jul 2007 12:24:05 GMT
[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.


Mime
View raw message