harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From qi...@apache.org
Subject svn commit: r886079 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/Arrays.java test/api/common/org/apache/harmony/luni/tests/java/util/ArraysTest.java
Date Wed, 02 Dec 2009 09:11:19 GMT
Author: qiuxx
Date: Wed Dec  2 09:11:18 2009
New Revision: 886079

URL: http://svn.apache.org/viewvc?rev=886079&view=rev
Log:
Revert r886043 "Apply for HARMONY-6395,  [classlib][luni] Arrays.sort(double []) will result
in StackOverflowError for specific arrays input"

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ArraysTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java?rev=886079&r1=886078&r2=886079&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java Wed Dec
 2 09:11:18 2009
@@ -1495,23 +1495,6 @@
         }
         return equals((short[]) e1, (short[]) e2);
     }
-    
-    private static boolean isSame(double double1, double double2) {
-        // This method is required as Double.NaN == Double.NaN will return false.
-        long d1, d2;
-        long NaNbits = Double.doubleToLongBits(Double.NaN);
-        if ((d1 = Double.doubleToLongBits(double1)) == NaNbits) {
-            if ((d2 = Double.doubleToLongBits(double2)) == NaNbits) {
-                return true;
-            } else {
-                return false;
-            }
-        } else if ((d2 = Double.doubleToLongBits(double2)) == NaNbits) {
-            return false;
-        } else {
-            return double1 == double2;
-        }
-    }
 
     private static boolean lessThan(double double1, double double2) {
         // A slightly specialized version of
@@ -1913,7 +1896,7 @@
         c = d = end - 1;
         while (true) {
             while (b <= c && !lessThan(partionValue, array[b])) {
-                if (isSame(array[b], partionValue)) {
+                if (array[b] == partionValue) {
                     temp = array[a];
                     array[a++] = array[b];
                     array[b] = temp;
@@ -1921,7 +1904,7 @@
                 b++;
             }
             while (c >= b && !lessThan(array[c], partionValue)) {
-                if (isSame(array[c], partionValue)) {
+                if (array[c] == partionValue) {
                     temp = array[c];
                     array[c] = array[d];
                     array[d--] = temp;

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ArraysTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ArraysTest.java?rev=886079&r1=886078&r2=886079&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ArraysTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ArraysTest.java
Wed Dec  2 09:11:18 2009
@@ -911,13 +911,9 @@
 		double[] specials2 = new double[] { 0d, Double.POSITIVE_INFINITY, -0d,
 				Double.NEGATIVE_INFINITY, Double.MIN_VALUE, Double.NaN,
 				Double.MAX_VALUE };
-        double[] specials3 = new double[] { Double.NaN, 1.0, 2.0, Double.NaN,
-                Double.NaN, 1.0, 3.0 };
 		double[] answer = new double[] { Double.NEGATIVE_INFINITY, -0d, 0d,
 				Double.MIN_VALUE, Double.MAX_VALUE, Double.POSITIVE_INFINITY,
 				Double.NaN };
-        double[] answer3 = new double[] { 1.0, 1.0, 2.0, 3.0, Double.NaN,
-                Double.NaN, Double.NaN };
 
 		Arrays.sort(specials1);
 		Object[] print1 = new Object[specials1.length];
@@ -932,13 +928,6 @@
 			print2[i] = new Double(specials2[i]);
 		assertTrue("specials sort incorrectly 2: " + Arrays.asList(print2),
 				Arrays.equals(specials2, answer));
-
-        Arrays.sort(specials3);
-        Object[] print3 = new Object[specials3.length];
-        for (int i = 0; i < specials3.length; i++)
-            print3[i] = new Double(specials3[i]);
-        assertTrue("specials sort incorrectly 3: " + Arrays.asList(print3),
-                Arrays.equals(specials3, answer3));
 	}
 
 	/**



Mime
View raw message