RFR:JDK-8066806:java.time.format.DateTimeFormatter cannot parse an offset with single digit hour

Roger Riggs Roger.Riggs at Oracle.com
Fri May 27 13:47:09 UTC 2016


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


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