Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 7926 invoked from network); 10 Feb 2009 04:58:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Feb 2009 04:58:47 -0000 Received: (qmail 83648 invoked by uid 500); 10 Feb 2009 04:58:47 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 83628 invoked by uid 500); 10 Feb 2009 04:58:47 -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 83619 invoked by uid 99); 10 Feb 2009 04:58:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Feb 2009 20:58:46 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED 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; Tue, 10 Feb 2009 04:58:46 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E816423889F3; Tue, 10 Feb 2009 04:58:25 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r742850 - 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: Tue, 10 Feb 2009 04:58:23 -0000 To: commits@harmony.apache.org From: qiuxx@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090210045825.E816423889F3@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: qiuxx Date: Tue Feb 10 04:58:20 2009 New Revision: 742850 URL: http://svn.apache.org/viewvc?rev=742850&view=rev Log: Revert patch at r680223, the testcase is not proper, and this patch will cause new issue described at HARMONY-6076([eut][classlib][luni] - Arrays.sort(T[] a, Comparator c) is not stable) 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=742850&r1=742849&r2=742850&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 Tue Feb 10 04:58:20 2009 @@ -2520,7 +2520,7 @@ Object fromVal = in[start]; Object rVal = in[r]; if (c.compare(fromVal, rVal) <= 0) { - int l_1 = find(in, rVal, 0, start + 1, med - 1, c); + int l_1 = find(in, rVal, -1, start + 1, med - 1, c); int toCopy = l_1 - start + 1; System.arraycopy(in, start, out, i, toCopy); i += toCopy; 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=742850&r1=742849&r2=742850&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 Tue Feb 10 04:58:20 2009 @@ -1296,8 +1296,7 @@ /** * @tests java.util.Arrays#sort(java.lang.Object[], java.util.Comparator) */ - @SuppressWarnings("unchecked") - public void test_sort$Ljava_lang_ObjectLjava_util_Comparator() { + public void test_sort$Ljava_lang_ObjectLjava_util_Comparator() { // Test for method void java.util.Arrays.sort(java.lang.Object [], // java.util.Comparator) ReversedIntegerComparator comp = new ReversedIntegerComparator(); @@ -1307,52 +1306,6 @@ comp .compare(objectArray[counter], objectArray[counter + 1]) <= 0); - - // Test the sort functionailty with an Integer array - int[] original = { 190, 180, 170, 160, 150, 140, 120, 320, 110, 310, - 100, 300, 290, 280, 270, 260, 250, 240, 230, 210, 200 }; - Integer[] sorted = { 100, 110, 120, 140, 150, 160, 170, 180, 190, 200, - 210, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320 }; - - Integer[] elements = new Integer[original.length]; - for (int i=0; i < original.length; i++){ - elements[i] = new Integer(original[i]); - } - - Comparator normalComparator = new Comparator(){ - public int compare(Object o1, Object o2) { - Integer e1 = (Integer)o1; - Integer e2 = (Integer)o2; - if (e1 > e2){ - return 1; - }else if(e1 < e2){ - return -1; - }else{ - return 0; - } - } - }; - Arrays.sort(elements, normalComparator); - // After sorting, elements should be the same as sorted array. - for(int i = 0; i < original.length; i++){ - assertEquals(sorted[i],elements[i]); - } - - for (int i=0; i < original.length; i++){ - elements[i] = new Integer(original[i]); - } - Comparator comparator = new Comparator(){ - public int compare(Object o1, Object o2) { - Integer e1 = (Integer)o1; - Integer e2 = (Integer)o2; - return e1 > e2 ? 1 : 0; - } - }; - Arrays.sort(elements, comparator); - // After sorting, elements should be the same as sorted array. - for(int i = 0; i < original.length; i++){ - assertEquals(sorted[i],elements[i]); - } } /**