harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Yu (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-2422) [classlib][luni] Can not set negative value to java.util.GregorianCalendar.ZONE_OFFSET
Date Wed, 16 Apr 2008 10:43:22 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-2422?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jim Yu updated HARMONY-2422:
----------------------------

    Attachment: HARMONY-2422.diff

This patch adds verification of whether the ZONE_OFFSET field has been set before setting
its value in computeFields(). If the
field has been set already, we will not set it again. It can solve this issue.

> [classlib][luni] Can not set negative value to java.util.GregorianCalendar.ZONE_OFFSET
> --------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2422
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2422
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Artem Aliev
>         Attachments: HARMONY-2422.diff
>
>
> 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.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message