Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 90243 invoked from network); 15 Aug 2006 06:19:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 15 Aug 2006 06:19:04 -0000 Received: (qmail 94510 invoked by uid 500); 15 Aug 2006 06:19:03 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 94479 invoked by uid 500); 15 Aug 2006 06:19:03 -0000 Mailing-List: contact harmony-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-commits@incubator.apache.org Received: (qmail 94468 invoked by uid 99); 15 Aug 2006 06:19:03 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Aug 2006 23:19:03 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Aug 2006 23:19:00 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 1CFF01A981A; Mon, 14 Aug 2006 23:18:40 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r431540 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/TreeMap.java test/java/tests/api/java/util/TreeMapTest.java Date: Tue, 15 Aug 2006 06:18:39 -0000 To: harmony-commits@incubator.apache.org From: pyang@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060815061840.1CFF01A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: pyang Date: Mon Aug 14 23:18:39 2006 New Revision: 431540 URL: http://svn.apache.org/viewvc?rev=431540&view=rev Log: Patch applied for HARMONY-1161 ([classlib][luni] java.util.TreeMap.subMap(Object, Object).size() throws unspecified NPE.) Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TreeMap.java incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TreeMapTest.java Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TreeMap.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TreeMap.java?rev=431540&r1=431539&r2=431540&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TreeMap.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/TreeMap.java Mon Aug 14 23:18:39 2006 @@ -186,7 +186,7 @@ @Override public boolean hasNext() { - return (node != null) && (cmp.compare(endKey, node.key) > 0); + return (node != null) && (cmp.compare( node.key, endKey ) < 0); } } Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TreeMapTest.java URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TreeMapTest.java?rev=431540&r1=431539&r2=431540&view=diff ============================================================================== --- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TreeMapTest.java (original) +++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/TreeMapTest.java Mon Aug 14 23:18:39 2006 @@ -54,6 +54,20 @@ return c1.compareTo(c2); } } + + // Regression for Harmony-1161 + class MockComparatorNullTolerable implements Comparator { + + public int compare(String o1, String o2) { + if( o1 == o2 ) { + return 0; + } + if( null == o1 ) { + return -1; + } + return o1.compareTo(o2); + } + } TreeMap tm; @@ -367,6 +381,13 @@ } assertEquals("end key less than start key should throw IllegalArgumentException", 1, result); + + // Regression for Harmony-1161 + TreeMap treeMapWithNull = new TreeMap(new MockComparatorNullTolerable()); + treeMapWithNull.put("key1" , "value1"); //$NON-NLS-1$ //$NON-NLS-2$ + treeMapWithNull.put(null, "value2"); //$NON-NLS-1$ + SortedMap subMapWithNull = treeMapWithNull.subMap( null, "key1"); //$NON-NLS-1$ + assertEquals("Size of subMap should be 1:", 1, subMapWithNull.size()); //$NON-NLS-1$ } /**