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

DateTimeFormatter fixed width adjacent value parsing does not match spec

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Introduced In Version:
      8
    • Resolved In Build:
      b08

      Backports

        Description

        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.

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved: