You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Bruno P. Kinoshita (JIRA)" <ji...@apache.org> on 2015/04/30 13:05:06 UTC

[jira] [Issue Comment Deleted] (LANG-1116) DateUtilsTest.testLang530 fails for some timezones

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

Bruno P. Kinoshita updated LANG-1116:
-------------------------------------
    Comment: was deleted

(was: >I found out that testLang530 seems to fail when you're in UTC!

Confirmed, indeed failing in UTC. Furthermore, it fails in my time zone too: "Pacific/Auckland", and works in "America/Sao Paulo".

Isolating the code and debugging, looks like the pattern used is constant, but the ISO 8601 string is formatted differently depending on the time zone selected. As the example below.

{noformat}
Success parsing date [2015-04-30T09:21:17+00:00] format [yyyy-MM-dd'T'HH:mm:ssZZ]

Failed to parse date [2015-04-30T09:21:33Z] format [yyyy-MM-dd'T'HH:mm:ssZZ]

Failed to parse date [2015-04-30T21:32:13+12:00] format [yyyy-MM-dd'T'HH:mm:ssZZ]
{noformat}

The first value between [] has different values for "America/Sao Paulo", "UTC" and "Pacific/Auckland" respectively. )

> DateUtilsTest.testLang530 fails for some timezones
> --------------------------------------------------
>
>                 Key: LANG-1116
>                 URL: https://issues.apache.org/jira/browse/LANG-1116
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.time.*
>    Affects Versions: 3.4
>         Environment: Redhat 5 / Java8u45
>            Reporter: Aaron Sheldon
>             Fix For: Discussion
>
>         Attachments: lang-1116.patch, lang-1116.patch
>
>
> Unit test for testLang530 fails when the isoDateStr comes out with just a Z instead of +00:00.
> {code}
> Tests run: 38, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.014 sec <<< FAILURE! - in org.apache.commons.lang3.time.DateUtilsTest
> testLang530(org.apache.commons.lang3.time.DateUtilsTest)  Time elapsed: 0.005 sec  <<< ERROR!
> java.text.ParseException: Unable to parse the date: 2015-04-17T18:51:52Z
>         at org.apache.commons.lang3.time.DateUtils.parseDateWithLeniency(DateUtils.java:401)
>         at org.apache.commons.lang3.time.DateUtils.parseDate(DateUtils.java:301)
>         at org.apache.commons.lang3.time.DateUtils.parseDate(DateUtils.java:278)
>         at org.apache.commons.lang3.time.DateUtilsTest.testLang530(DateUtilsTest.java:1222)
> {code}
> On a Linux machine where this test passes, isoDateStr is 2015-04-17T19:26:03+00:00.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)