Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 99887 invoked from network); 17 Feb 2010 20:20:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 17 Feb 2010 20:20:13 -0000 Received: (qmail 32774 invoked by uid 500); 17 Feb 2010 20:20:12 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 32712 invoked by uid 500); 17 Feb 2010 20:20:12 -0000 Mailing-List: contact dev-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 dev@harmony.apache.org Received: (qmail 32701 invoked by uid 99); 17 Feb 2010 20:20:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Feb 2010 20:20:12 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: 194.196.100.164 is neither permitted nor denied by domain of mark.hindess@googlemail.com) Received: from [194.196.100.164] (HELO mtagate4.uk.ibm.com) (194.196.100.164) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Feb 2010 20:20:03 +0000 Received: from d06nrmr1806.portsmouth.uk.ibm.com (d06nrmr1806.portsmouth.uk.ibm.com [9.149.39.193]) by mtagate4.uk.ibm.com (8.13.1/8.13.1) with ESMTP id o1HKJf2L010047 for ; Wed, 17 Feb 2010 20:19:41 GMT Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by d06nrmr1806.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o1HKJfdD1343692 for ; Wed, 17 Feb 2010 20:19:41 GMT Received: from d06av01.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id o1HKJf9Z002563 for ; Wed, 17 Feb 2010 20:19:41 GMT Received: from anaheim.local (gbv83124.uk.ibm.com [9.145.115.159]) by d06av01.portsmouth.uk.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id o1HKJf33002559 for ; Wed, 17 Feb 2010 20:19:41 GMT Message-Id: <201002172019.o1HKJf33002559@d06av01.portsmouth.uk.ibm.com> X-Mailer: exmh version 2.7.2 01/07/2005 (debian 1:2.7.2-18) with nmh-1.3 In-reply-to: <20100217192622.3B6B847841B@athena.apache.org> References: <201002171703.o1HH3GNp017551@d12av04.megacenter.de.ibm.com> <20100217192622.3B6B847841B@athena.apache.org> Comments: In-reply-to Mark Hindess message dated "Wed, 17 Feb 2010 19:25:32 +0000." From: Mark Hindess To: dev@harmony.apache.org Subject: Re: svn commit: r910980 - /harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/TreeMap.java Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 17 Feb 2010 20:19:41 +0000 In message <20100217192622.3B6B847841B@athena.apache.org>, Mark Hindess writes: > > In message , > Jesse Wilson writes: > > > > On Wed, Feb 17, 2010 at 9:03 AM, Mark Hindess > > wrote: > > > > > I have solid evidence that this change is wrong... it breaks Harmony > > > tests that pass on the RI. I've no solid evidence that this change > > > is required. So my inclination is not to put the check back. > > > > That's curious, but I guess I haven't looked into the navigable stuff > > that's new in 1.6. > > > > > A null check may be required but I'm not convinced this is the right > > > place for it. The toComparable method is just a trivial helper > > > function that is clearly being used (probably quite reasonably) in a > > > context that doesn't require a null check. > > > > I think toComparable() is the right place. TreeMaps operates in two > > different modes: > > > > - *With a comparator.* In this mode objects don't need to be comparable. > > Null is permitted, because comparators can decide where null fits in the > > total ordering. > > > - *Without a comparator.* In this mode everything must be comparable. > > Null is not comparable and must be forbidden. > > That was my understanding too but I'm assuming it is not that simple. I > suppose the other option is that toComparable is being called when it > should not be. Turns out it is simply a problem with the ordering of the checks for: a) null keys b) empty maps For several method the RI obviously checks if a map is empty and returns null with no exception regardless of the key where as with your fix the null key causes an exception first. A number of methods are protected with an isEmpty check - root == null - that short circuits the full traversal but some are not. I'll fix them shortly and re-instate your fix. > > > Sorry, I've not got time to investigate this further right now > > > but rest assured we will get to the bottom of it and fix it > > > correctly. Raise a JIRA if you want to make sure it doesn't get > > > forgotten. > > > > Sounds good. > > I've reopened (but removed the must-fix-for-6.0M1 status) the JIRA at: > > https://issues.apache.org/jira/browse/HARMONY-6448 > > to track this issue. Closed again as you opened HARMONY-6451 to track it. I'll update this thread and the JIRA when I've fixed it. Regards, -Mark.