commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bruno P. Kinoshita (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-942) Test failure in FastDateParserTest and FastDateFormat_ParserTest when building with JDK8
Date Fri, 03 Jan 2014 16:12:51 GMT

    [ https://issues.apache.org/jira/browse/LANG-942?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13861624#comment-13861624
] 

Bruno P. Kinoshita commented on LANG-942:
-----------------------------------------

Digging into this issue right now. Looks like one of the strategies (FastDateParser$TimeZoneStrategy)
changes the timezone. 

Was:

sun.util.calendar.ZoneInfo[
  id="America/New_York",
  offset=-18000000,
  dstSavings=3600000,
  useDaylight=true,
  transitions=235,
  lastRule=
    java.util.SimpleTimeZone[
      id=America/New_York,
      offset=-18000000,
      dstSavings=3600000,
      useDaylight=true,
      startYear=0,
      startMode=3,
      startMonth=2,
      startDay=8,
      startDayOfWeek=1,
      startTime=7200000,
      startTimeMode=0,
      endMode=3,
      endMonth=10,
      endDay=1,
      endDayOfWeek=1,
      endTime=7200000,
      endTimeMode=0
    ]
]

And inside the FastDateParser#parse() method, when this strategy is applied to a calendar
created using the TimeZone and Locale, the new time zone is set from America/New_York to IET:

sun.util.calendar.ZoneInfo[
  id="IET",
  offset=-18000000,
  dstSavings=3600000,
  useDaylight=true,
  transitions=98,
  lastRule=java.util.SimpleTimeZone[
      id=IET,offset=-18000000,
      dstSavings=3600000,
      useDaylight=true,
      startYear=0,
      startMode=3,
      startMonth=2,
      startDay=8,
      startDayOfWeek=1,
      startTime=7200000,
      startTimeMode=0,
      endMode=3,
      endMonth=10,
      endDay=1,
      endDayOfWeek=1,
      endTime=7200000,
      endTimeMode=0
    ]
]

The fields in the Calendar seem to be correctly set ([1, 2003, 6, 0, 0, 10, 0, 5, 0, 1, 4,
16, 33, 20, 0, 0, 0] -> 2003-07-10T16:33:20.000), but Calendar.getTime() returns the date
with hour + 2. Thus, instead of Thu Jul 10 17:33:20 BRT 2003, I'm getting Thu Jul 10 18:33:20
BRT 2003.

The TimeZoneStrategy has a Map with all the possible time zones names, where each timezone
is set as value, while the long and short names are used as key. Will dig some more to figure
out why America/New_York became IET :-) 

> Test failure in FastDateParserTest and FastDateFormat_ParserTest when building with JDK8
> ----------------------------------------------------------------------------------------
>
>                 Key: LANG-942
>                 URL: https://issues.apache.org/jira/browse/LANG-942
>             Project: Commons Lang
>          Issue Type: Sub-task
>          Components: lang.time.*
>    Affects Versions: 3.2
>         Environment: JDK8
>            Reporter: Benedikt Ritter
>             Fix For: 3.2.1
>
>
> The following failure is thrown when using JDK 8:
> {code}
> -------------------------------------------------------------------------------
> Test set: org.apache.commons.lang3.time.FastDateFormat_ParserTest
> -------------------------------------------------------------------------------
> Tests run: 29, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.315 sec <<<
FAILURE! - in org.apache.commons.lang3.time.FastDateFormat_ParserTest
> testParseZone(org.apache.commons.lang3.time.FastDateFormat_ParserTest)  Time elapsed:
0.005 sec  <<< FAILURE!
> java.lang.AssertionError: expected:<Thu Jul 10 22:33:20 CEST 2003> but was:<Thu
Jul 10 23:33:20 CEST 2003>
> 	at org.junit.Assert.fail(Assert.java:88)
> 	at org.junit.Assert.failNotEquals(Assert.java:743)
> 	at org.junit.Assert.assertEquals(Assert.java:118)
> 	at org.junit.Assert.assertEquals(Assert.java:144)
> 	at org.apache.commons.lang3.time.FastDateParserTest.testParseZone(FastDateParserTest.java:119)
> 	[...]
> {code}
> It is caused by the following assertion in FastDateParserTest (from which FastDateFormat_ParserTest
inherits):
> {code:java}
> assertEquals(cal.getTime(), fdf.parse("2003-07-10T16:33:20.000 Eastern Daylight Time"));
> {code}
> {{FastDateParserTest}} fails with the same error.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message