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

{Float, Double}.valueOf use broken test for whitespace characters

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P5 P5
    • 5.0
    • 1.4.2
    • core-libs
    • None
    • tiger
    • generic
    • generic

      The specification for the methods {Float, Double}.valueOf (which convert strings into floating-point values) states "Leading and trailing whitespace characters in s are ignored." However, what characters are considered whitespace is not defined. The methods indirectly calls trim on the string. The trim method discards ASCII control characters but not the many other characters considered whitespace in unicode or Java. So the current implementation both accepts strings that should not be accepted (those with control characters) and rejects strings that should be accepted (those with non-ASCII whitespace).

      This should be fixed.

            darcy Joe Darcy
            darcy Joe Darcy
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: