Harmony
  1. Harmony
  2. HARMONY-107

java.text.DecimalFormat does not parse infinite values correctly

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Classlib
    • Labels:
      None

      Description

      In Java 1.4.2 Spec of java.text.DecimalFormat.parse(String, ParsePosition), it's said:
      Values that cannot fit into a Long are returned as Doubles. This includes values with a fractional part, infinite values, NaN, and the value -0.0.

      The test cases will fail if excuting under Harmony and pass on RI:

      // Test whether DecimalFormat can parse Positive infinity correctly
      public void testParseInfinityBigDecimalFalse()

      { DecimalFormat format = (DecimalFormat) DecimalFormat.getInstance(); DecimalFormatSymbols symbols = new DecimalFormatSymbols(); Number number = format.parse(symbols.getInfinity(), new ParsePosition(0)); assertTrue(number instanceof Double); assertTrue(Double.isInfinite(number.doubleValue())); }

      // Test whether DecimalFormat can parse Negative infinity correctly
      public void testParseMinusInfinityBigDecimalFalse()

      { DecimalFormat format = (DecimalFormat) DecimalFormat.getInstance(); DecimalFormatSymbols symbols = new DecimalFormatSymbols(); Number number = format.parse("-" + symbols.getInfinity(), new ParsePosition(0)); assertTrue(number instanceof Double); assertTrue(Double.isInfinite(number.doubleValue())); }

        Issue Links

          Activity

          No work has yet been logged on this issue.

            People

            • Assignee:
              Unassigned
              Reporter:
              Richard Liang
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development