[
https://issues.apache.org/jira/browse/LANG-1116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14520015#comment-14520015
]
Benedikt Ritter commented on LANG-1116:
---------------------------------------
[~asheldon] Thank you! I found out that testLang530 seems to fail when you're
in UTC! So modifing the test like so:
{code:java}
@Test
public void testLang530() throws ParseException {
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
final Date d = new Date();
final String isoDateStr =
DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(d);
final Date d2 = DateUtils.parseDate(isoDateStr, new String[] {
DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern() });
// the format loses milliseconds so have to reintroduce them
assertEquals("Date not equal to itself ISO formatted and parsed",
d.getTime(), d2.getTime() + d.getTime() % 1000);
}
{code}
Will make it fail on my machine. I'll update the description of this ticket.
Now we have to find a fix that works on your machine and on my machine :-) I'm
currently in CEST.
> 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: Review Patch
>
> 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.
> 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)
> 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)