Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8032491

DateTimeFormatter fixed width adjacent value parsing does not match spec

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 9
    • core-libs
    • None
    • 8
    • b08

        The adjacent value parsing spec includes the phrase "If adjacent parsing is active, then parsing must match exactly the specified number of digits in both strict and lenient modes." in the method appendValue(TemporalField field, int width). Unfortunately, the spec is not correctly implemented when the first field in an adjacent parsing set is fixed width.

        In strict mode, the first field in an adjacent parsing set uses its fixed width correctly producing the correct result. However it uses an inefficient double parse internally.

        In lenient mode the first field in an adjacent parsing set is converted to be variable width producing the wrong result, and not conforming to the spec.

        This can be noticed using a pattern of HHmm'9' which parses in strict mode but fails in lenient mode.

        Discovered via JDK-8031085.

              rriggs Roger Riggs
              scolebourne Stephen Colebourne
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: