commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <>
Subject [jira] [Commented] (LANG-996) FastDateFormat is case sensitive
Date Mon, 21 Apr 2014 20:43:20 GMT


Sebb commented on LANG-996:

Looks like this will need a new version of the TextStrategy that supports case-blind matching.
This could perhaps be done by converting the month strings to lower case in the map; then
converting the input value to lowercase before looking up the map.
The Locale is known when creating a Strategy, however it is not provided when parsing using
the setCalendar method.
The Strategy interface is private, so it would be possible to change the setCalendar method
to pass in the Locale.

> FastDateFormat is case sensitive
> --------------------------------
>                 Key: LANG-996
>                 URL:
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.time.*
>    Affects Versions: 3.3.2
>            Reporter: David Rees
>             Fix For: Patch Needed, 3.4
> It seems that {{FastDateFormat}} is case sensitive. But it claims to be mostly compatible
with {{SimpleDateFormat}} which is not.
> For example, this throws a {{ParseException}}:
> {code:java}
> FastDateFormat.getInstance("dd-MMM-yyyy").parse("01-jan-2000");
> {code}
> But these do not:
> {code:java}
> SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy");
> sdf.parse("01-jan-2000");
> DateUtils.parse("01-jan-2000", "dd-MMM-yyyy");
> {code}

This message was sent by Atlassian JIRA

View raw message