commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Honton, Charles" <Charles_Hon...@intuit.com>
Subject Re: svn commit: r1389976 - in /commons/proper/lang/trunk/src: changes/changes.xml main/java/org/apache/commons/lang3/time/FastDateParser.java test/java/org/apache/commons/lang3/time/FastDateParserTest.java
Date Wed, 26 Sep 2012 18:33:10 GMT
Very cool, Thanks for a more elegant solution.

chas

On 9/26/12 11:14 AM, "sebb" <sebbaz@gmail.com> wrote:

>On 25 September 2012 18:26, sebb <sebbaz@gmail.com> wrote:
>> On 25 September 2012 18:06, Honton, Charles <Charles_Honton@intuit.com>
>>wrote:
>>> Seems a little extreme solution.
>>
>> At least it allows the class to work with all Locales now, whereas
>> previously it would fail with those locales.
>>
>>> Exactly where does the FastDateParser fail with non-Gregorian
>>>calendars?
>>
>> You can try it and see - just  comment out the code in FastDateParser
>> that creates the SimpleDateFormatStrategy.
>>
>> The main problem is that the formatted date output does not match the
>> generated regex.
>>
>> In the case of ja_JP_JP this is because the short form era
>> designations (M T S H) are not returned by the getEras() method.
>> I tried patching these in, but then the issue is that the eras are
>> quite complicated to evaluate, see [1]
>>
>> If you have a patch to fix that, please create a JIRA issue and attach
>>it.
>
>Fixed.
>
>Turns out that DateFormatSymbols#getEras() is only supposed to return
>AD/BC; one has to use Calendar#getDisplayNames() to fetch the LONG and
>SHORT era designators for th_TH and ja_JP_JP.
>
>Once the correct strings are used, parsing works fine.
>
>>> The parser should just be setting fields on a Calendar object which
>>>does the calculations.
>>
>> It does.
>>
>>> Are the fields being properly parsed?
>>
>> No, see above.
>>
>>> Is a proper Calendar object being created?
>>
>> Yes.
>>
>>> chas
>>
>> [1] 
>>http://docs.oracle.com/javase/6/docs/technotes/guides/intl/calendar.doc.h
>>tml
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>For additional commands, e-mail: dev-help@commons.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message