harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r791933 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/native/luni/shared/fltparse.c test/api/common/org/apache/harmony/luni/tests/java/lang/FloatTest.java
Date Tue, 07 Jul 2009 18:33:31 GMT
Author: tellison
Date: Tue Jul  7 18:33:31 2009
New Revision: 791933

URL: http://svn.apache.org/viewvc?rev=791933&view=rev
Log:
Fix for HARMONY-6261 ([classlib][luni] Float parse causes OutOfMemoryException)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/FloatTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c?rev=791933&r1=791932&r2=791933&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c Tue
Jul  7 18:33:31 2009
@@ -221,7 +221,6 @@
   jfloat result;
 
   numBits = highestSetBitHighPrecision (f, length) + 1;
-  numBits -= lowestSetBitHighPrecision (f, length);
   if (numBits < 25 && e >= 0 && e < LOG5_OF_TWO_TO_THE_N)
     {
       return ((jfloat) LOW_I32_FROM_PTR (f)) * tenToTheE (e);

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/FloatTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/FloatTest.java?rev=791933&r1=791932&r2=791933&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/FloatTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/FloatTest.java
Tue Jul  7 18:33:31 2009
@@ -783,6 +783,19 @@
     }
 
     /**
+     * @tests java.lang.Float#parseFloat(java.lang.String)
+     */
+    public void test_parseFloat_LString_Harmony6261() {
+        // Regression test for HARMONY-6261
+        float f = new Float("2147483648");
+        assertEquals("2.1474836E9", Float.toString(f));
+
+        doTestCompareRawBits("123456790528.000000000000000f", 0x51e5f4c9, "1.2345679E11");
+        doTestCompareRawBits("8589934592", 0x50000000, "8.5899346E9");
+        doTestCompareRawBits("8606711808", 0x50004000, "8.606712E9");
+    }
+    
+    /**
      * @tests java.lang.Float#shortValue()
      */
     public void test_shortValue() {



Mime
View raw message