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

Stephen Colebourne scolebourne at joda.org
Tue May 31 13:45:18 UTC 2016


Where the new patterns are described in Javadoc, there is no
discussion of the difference between "H" and "HH".

Add after </ul>

"Patterns containing "HH" will format and parse a two digit hour,
zero-padded if necessary. Patterns containing "H" will format with no
zero-padding, and parse either one or two digits."

"with colo" should be "with colon"

As for the main code, I've had a go at a rewrite:
https://gist.github.com/jodastephen/68857dd344e33bd6c0b3b4d24279d2e4

It is completely untested, and surely has mistakes, however as a
design it seems reasonable.

I agree that the tests need to cover these cases:

- offset at end of line
- offset followed by letters
- offset followed by numbers

Stephen


On 26 May 2016 at 08:49, nadeesh tv <nadeesh.tv at oracle.com> 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
>
> --
> Thanks and Regards,
> Nadeesh TV
>



More information about the core-libs-dev mailing list