You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Saksham Gupta (JIRA)" <ji...@apache.org> on 2019/07/27 12:30:00 UTC

[jira] [Comment Edited] (LANG-1465) DateUtils.parseDate backward Incompatibility bug

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

Saksham Gupta edited comment on LANG-1465 at 7/27/19 12:29 PM:
---------------------------------------------------------------

I think I have found the solution to this.

[~britter] [~ggregory1] - Please let me know your thoughts on the below fix.

In FastDateParser.java we have this:
{code:java}
private static final Strategy ISO_8601_3_STRATEGY = new ISO8601TimeZoneStrategy("(Z|(?:[+-]\\d{2}(?::)\\d{2}))");{code}
We can replace it with this:
{noformat}
 private static final Strategy ISO_8601_3_STRATEGY = new ISO8601TimeZoneStrategy("(Z|(?:[+-]\\d{2}(:?)\\d{2}))");
{noformat}


was (Author: saksham63):
I think I have found the solution to this.

In FastDateParser.java we have this:
{code:java}
private static final Strategy ISO_8601_3_STRATEGY = new ISO8601TimeZoneStrategy("(Z|(?:[+-]\\d{2}(?::)\\d{2}))");{code}
We can replace it with this:
{noformat}
 private static final Strategy ISO_8601_3_STRATEGY = new ISO8601TimeZoneStrategy("(Z|(?:[+-]\\d{2}(:?)\\d{2}))");
{noformat}

> DateUtils.parseDate backward Incompatibility bug
> ------------------------------------------------
>
>                 Key: LANG-1465
>                 URL: https://issues.apache.org/jira/browse/LANG-1465
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.time.*
>    Affects Versions: 3.5, 3.6, 3.7, 3.8, 3.9, 3.8.1
>         Environment: System: Linux testinglab 4.4.0-131-generic #157~14.04.1-Ubuntu
> Java version "1.8.0_191"
> Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
> Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
>  
>  
>            Reporter: xia0c
>            Priority: Major
>              Labels: performance
>
> Hi,
> The following code snippets throw a ParseException when trying to parse the time. It works well before commons-lang 3.4. When I update commons-lang to 3.5 or newer versions, it failed.
> {code:java}
> 	@Test
> 	public void Demo() throws ParseException {
> 		assertEquals("Tue Jun 11 15:06:11 CDT 2019", DateUtils.parseDate("2019-06-11T15:06:11.716-0500", "yyyy-MM-dd'T'HH:mm:ss.SSSZZ"));
> 		
> 	}
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)