From commits-return-61017-apmail-harmony-commits-archive=harmony.apache.org@harmony.apache.org Wed Dec 02 09:11:43 2009 Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 35402 invoked from network); 2 Dec 2009 09:11:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 2 Dec 2009 09:11:43 -0000 Received: (qmail 4346 invoked by uid 500); 2 Dec 2009 09:11:43 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 4297 invoked by uid 500); 2 Dec 2009 09:11:42 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 4288 invoked by uid 99); 2 Dec 2009 09:11:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Dec 2009 09:11:41 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00 X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Dec 2009 09:11:39 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 522F523889DF; Wed, 2 Dec 2009 09:11:19 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@harmony.apache.org From: qiuxx@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091202091119.522F523889DF@eris.apache.org> 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)); } /**