RFR:JDK-8066806:java.time.format.DateTimeFormatter cannot parse an offset with single digit hour
Daniel Fuchs
daniel.fuchs at oracle.com
Fri May 27 14:04:51 UTC 2016
On 27/05/16 15:47, Roger Riggs wrote:
> Hi Nadeesh,
>
> Seeing the complexity of this code expand, I can't help wonder if there
> is a
> better algorithm. Perhaps by trying to parse a 1 to 3 numbers(of 1 or
> two digits) with optional ":"s.
> And then match that to the valid patterns.
> The use of numeric indices obscures what is going on.
>
> Also, there are a number of conditions that depend on the length of the
> remaining input.
> I suspect that when appendOffset is used to parse a sequence of fields,
> characters belonging
> to the following fields will throw off the checks. I didn't see any
> tests that would confirm that
> appendOffset with input for additional fields (and input) works as
> intended.
>
> Thanks, Roger
Hi,
Stephen is the expert here. However, I can't help feeling
that the patterns that allow you to parse/format a single
digit hour without the ':' separator ("+H" excepted) are
confusing. If we removed those (only adding +H, +H:mm, +H:MM,
+H:MM:ss, +H:MM:SS, +H:mm:ss) would the parsing be simplified?
Would that be an acceptable compromise?
best regards,
-- daniel
>
>
> On 5/26/2016 3:49 AM, nadeesh tv wrote:
>> Hi all,
>>
>> Please review
>>
>> BugId : https://bugs.openjdk.java.net/browse/JDK-8066806
>>
>> Issue: java.time.format.DateTimeFormatter cannot parse an offset with
>> single digit hour
>>
>> webrev: http://cr.openjdk.java.net/~ntv/8066806/webrev.03/
>>
>> Solution: Added the suggested patterns but the parsing logic became
>> too complex.
>> Appreciate any suggestion to make the parsing less complicated
>>
>
More information about the core-libs-dev
mailing list