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

java.time.Duration.parse examples are incorrect.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 9
    • Component/s: docs
    • Labels:
    • CPU:
      x86_64
    • OS:
      linux

      Description

      A DESCRIPTION OF THE PROBLEM :
      The negative amount examples sited are not valid, and do not parse.

          "P-6H3M" -- parses as "-6 hours and +3 minutes"
          "-P6H3M" -- parses as "-6 hours and -3 minutes"
          "-P-6H+3M" -- parses as "+6 hours and -3 minutes"

      They're missing the 'T' part. And should be:

          "PT-6H3M" -- parses as "-6 hours and +3 minutes"
          "-PT6H3M" -- parses as "-6 hours and -3 minutes"
          "-PT-6H+3M" -- parses as "+6 hours and -3 minutes"

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -

          "PT-6H3M" -- parses as "-6 hours and +3 minutes"
          "-PT6H3M" -- parses as "-6 hours and -3 minutes"
          "-PT-6H+3M" -- parses as "+6 hours and -3 minutes"
      ACTUAL -

          "P-6H3M" -- parses as "-6 hours and +3 minutes"
          "-P6H3M" -- parses as "-6 hours and -3 minutes"
          "-P-6H+3M" -- parses as "+6 hours and -3 minutes"

      URL OF FAULTY DOCUMENTATION :
      https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html#parse-java.lang.CharSequence-

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              aroy Abhijit Roy (Inactive)
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: