Return-Path: Delivered-To: apmail-incubator-harmony-commits-archive@www.apache.org Received: (qmail 29442 invoked from network); 20 Sep 2006 07:27:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 20 Sep 2006 07:27:01 -0000 Received: (qmail 15210 invoked by uid 500); 20 Sep 2006 07:27:01 -0000 Delivered-To: apmail-incubator-harmony-commits-archive@incubator.apache.org Received: (qmail 15110 invoked by uid 500); 20 Sep 2006 07:27:00 -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 15099 invoked by uid 99); 20 Sep 2006 07:27:00 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Sep 2006 00:27:00 -0700 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests= Received: from ([209.237.227.198:45240] helo=brutus.apache.org) by idunn.apache.osuosl.org (ecelerity 2.1 r(10620)) with ESMTP id 04/80-01762-44DE0154 for ; Wed, 20 Sep 2006 00:27:00 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id E2E3C4190C8 for ; Wed, 20 Sep 2006 07:23:23 +0000 (GMT) Message-ID: <33548393.1158737003926.JavaMail.jira@brutus> Date: Wed, 20 Sep 2006 00:23:23 -0700 (PDT) From: "Paulex Yang (JIRA)" To: harmony-commits@incubator.apache.org Subject: [jira] Assigned: (HARMONY-1498) [classlib][luni][HashMap]It is not appropriate to use entrySet as judgement in HashMap.putAll() In-Reply-To: <33028951.1158720926501.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/HARMONY-1498?page=all ] Paulex Yang reassigned HARMONY-1498: ------------------------------------ Assignee: Paulex Yang > [classlib][luni][HashMap]It is not appropriate to use entrySet as judgement in HashMap.putAll() > ----------------------------------------------------------------------------------------------- > > Key: HARMONY-1498 > URL: http://issues.apache.org/jira/browse/HARMONY-1498 > Project: Harmony > Issue Type: Bug > Components: Classlib > Reporter: Leo Li > Assigned To: Paulex Yang > Attachments: patch.diff > > > We have: > if (map.entrySet() != null) {...} in HashMap.putAll(). > The most important thing is that It is tedious to get the entrySet from HashMap just to make a judgement. > Here I give out a testcase which I admit is too some degree extreme, however it is enough to show that to use entrySet as a judgement is not appropriate. > private static class MockMap extends AbstractMap > { > public Set entrySet() { > > return null; > } > > public int size() > { > return 10; > } > } > > public void testPutAll() > { > HashMap hashMap = new HashMap(); > try > { > hashMap.putAll(new MockMap()); > fail("should throw NullPointerException"); > } > catch(NullPointerException e) > { > //expected. > } > > > try > { > hashMap = new HashMap(new MockMap()); > fail("should throw NullPointerException"); > } > catch(NullPointerException e) > { > //expected. > } > } > RI passes > Harmony fails -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira