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 + ") = " +
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
http://incubator.apache.org/harmony

.gc =
java.util.GregorianCalendar[time=?,areFieldsSet=false,lenient=true,zone=java.util.SimpleTimeZone[id=Asia/Novosibirsk,offset=21600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=7200000,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=7200000],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA==?,YEAR==1,MONTH==1,WEEK_OF_YEAR==?,WEEK_OF_MONTH==?,DAY_OF_MONTH==1,DAY_OF_YEAR==?,DAY_OF_WEEK==?,DAY_OF_WEEK_IN_MONTH==?,AM_PM==?,HOUR==?,HOUR_OF_DAY=?,MINUTE==?,SECOND==?,MILLISECOND==?,ZONE_OFFSET==?,DST_OFFSET==?]
gc.get(15) = 21600000
F
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)

FAILURES!!!
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 =
java.util.GregorianCalendar[time=?,areFieldsSet=false,areAllFieldsSet=false,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Asia/Novosibirsk",offset=21600000,dstSavings=3600000,useDaylight=true,transitions=119,lastRule=java.util.SimpleTimeZone[id=Asia/Novosibirsk,offset=21600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=7200000,startTimeMode=1,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=7200000,endTimeMode=1]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=?,YEAR=1,MONTH=1,WEEK_OF_YEAR=?,WEEK_OF_MONTH=?,DAY_OF_MONTH=1,DAY_OF_YEAR=?,DAY_OF_WEEK=?,DAY_OF_WEEK_IN_MONTH=?,AM_PM=?,HOUR=?,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=?,ZONE_OFFSET=?,DST_OFFSET=?]
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
administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




-- 
Tony Wu
China Software Development Lab, IBM

Mime
View raw message