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

Duration toString and valueOf methods are not symetrical

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 9
    • javafx
    • None

      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().

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

              Created:
              Updated: