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

Duration toString and valueOf methods are not symetrical

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: tbd
    • Component/s: javafx
    • Labels:
      None
    • Subcomponent:

      Description

      The Duration class toString() method returns "INDEFINITE", "UNKNOWN", or a number followed by " ms", to represent duration. Conversely, the Duration.valueOf(String) method expects a string in the form "[number][ms|s|m|h]" to parse into a Duration.

      This results in two issues:

      1) when a user wishes to make a duration INDEFINITE or UNKNOWN from FXML, as the FXMLLoader simply calls Duration.valueOf(...), and this can not currently accept these strings.

      2) toString() includes a space between the number and the "ms" text, whereas valueOf(String) expects there to be no space. This means even valid output from toString() is not able to be parsed by valueOf().

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            jgiles Jonathan Giles
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: