harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Liang (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-107) java.text.DecimalFormat does not parse infinite values correctly
Date Mon, 20 Feb 2006 14:11:24 GMT
java.text.DecimalFormat does not parse infinite values correctly
----------------------------------------------------------------

         Key: HARMONY-107
         URL: http://issues.apache.org/jira/browse/HARMONY-107
     Project: Harmony
        Type: Bug
  Components: Classlib  
    Reporter: Richard Liang


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()));
    }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message