harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tony Wu" <wuyue...@gmail.com>
Subject Fwd: [jira] Created: (HARMONY-2422) [luni] Can not set negative value to java.util.GregorianCalendar.ZONE_OFFSET
Date Thu, 08 Feb 2007 12:33:48 GMT
spec says,
"This field reflects the correct GMT offset value of the time zone of
this Calendar if the TimeZone implementation subclass supports
historical GMT offset changes."

So, I think this field should always indicate the offset of the
timezone in calendar, it is meaningless to set a ZONE_OFFEST then get
it. Harmony always returns the offset of the calendar's inner
timezone, setting any values to this field will be ignored, besides
the nagative. I think it is reasonable, I suggest we close this issue
as a non bug difference. what's your opinion?

---------- Forwarded message ----------
From: Artem Aliev (JIRA) <jira@apache.org>
Date: Dec 4, 2006 8:59 PM
Subject: [jira] Created: (HARMONY-2422) [luni] Can not set negative
value to java.util.GregorianCalendar.ZONE_OFFSET
To: commits@harmony.apache.org

[luni] Can not set negative value to java.util.GregorianCalendar.ZONE_OFFSET

                Key: HARMONY-2422
                URL: http://issues.apache.org/jira/browse/HARMONY-2422
            Project: Harmony
         Issue Type: Bug
         Components: Classlib
           Reporter: Artem Aliev

If try to set negative value to ZONE_OFFSET field, it will be changed
to some positive value. RI doesn't have such behavior.

Probably compatibility issue.

Test to reproduce:

import junit.framework.TestCase;

import java.util.GregorianCalendar;

public class Test extends TestCase {

       public void testcase() {
               GregorianCalendar gc = new GregorianCalendar(1, 1, 1);
       System.out.println("gc = " + gc);
       gc.set(GregorianCalendar.ZONE_OFFSET, -1);
       System.out.println("gc.get(" + GregorianCalendar.ZONE_OFFSET + ") = " +
       assertTrue("gc.get(" + GregorianCalendar.ZONE_OFFSET + ") == -1",
(gc.get(GregorianCalendar.ZONE_OFFSET) == -1));

Output on Harmony:
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 = rsvn: '.' is not a working copy, (Sep 20 2006), Windows/ia32/msvc 1310,
release build

.gc =
gc.get(15) = 21600000
Time: 0.078
There was 1 failure:
1) testcase(Test)junit.framework.AssertionFailedError: gc.get(15) == -1
       at Test.testcase(Test.java:12)
       at java.lang.reflect.VMReflection.invokeMethod(Native Method)

Tests run: 1,  Failures: 1,  Errors: 0

res = 1

Output on RI:
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
.gc =
gc.get(15) = -1

Time: 0.016

OK (1 test)

res = 0

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the
For more information on JIRA, see: http://www.atlassian.com/software/jira

Tony Wu
China Software Development Lab, IBM

View raw message