Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 39261 invoked from network); 7 Mar 2006 11:09:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Mar 2006 11:09:55 -0000 Received: (qmail 28331 invoked by uid 500); 7 Mar 2006 11:09:51 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 28253 invoked by uid 500); 7 Mar 2006 11:09:50 -0000 Mailing-List: contact harmony-dev-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-dev@incubator.apache.org Received: (qmail 28229 invoked by uid 99); 7 Mar 2006 11:09:50 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Mar 2006 03:09:50 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Mar 2006 03:09:47 -0800 Received: from ajax (localhost.localdomain [127.0.0.1]) by ajax (Postfix) with ESMTP id 249ACD49FA for ; Tue, 7 Mar 2006 11:08:39 +0000 (GMT) Message-ID: <1412687702.1141729719140.JavaMail.jira@ajax> Date: Tue, 7 Mar 2006 11:08:39 +0000 (GMT) From: "Tim Ellison (JIRA)" To: harmony-dev@incubator.apache.org Subject: [jira] Closed: (HARMONY-93) some methods in java.util.Collections don't throw NPE when the parameter is null In-Reply-To: <1647884044.1139981829173.JavaMail.jira@ajax.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/HARMONY-93?page=all ] Tim Ellison closed HARMONY-93: ------------------------------ Verified by Svetlana > some methods in java.util.Collections don't throw NPE when the parameter is null > --------------------------------------------------------------------------------- > > Key: HARMONY-93 > URL: http://issues.apache.org/jira/browse/HARMONY-93 > Project: Harmony > Type: Bug > Components: Classlib > Reporter: Svetlana Samoilenko > Assignee: Tim Ellison > Attachments: CollectionsTest.java, fix.txt > > According to j2se 1.4.2 and 1.5 specification for the Collections class "The methods of this class all throw a NullPointerException if the collections provided to them are null". > Harmony does not throw NPE for some methods. > Code to reproduce: > import java.util.*; > public class test2 { > public static void main(String [] args) { > SortedMap m = null; > Map map=null; > Set set=null; > SortedSet sortedset=null; > SortedMap sortedmap =null; > Collection col=null; > try { > Collections.synchronizedCollection(col); > System.out.println("synchronizedCollection(null) must throw NPE"); > } catch (NullPointerException e) { > System.out.println("PASSED"); > } > try { > Collections.synchronizedSortedMap(sortedmap); > System.out.println("synchronizedSortedMap(null) must throw NPE"); > } catch (NullPointerException e) { > System.out.println("PASSED"); > } > try { > Collections.synchronizedMap(map); > System.out.println("synchronizedMap(map) must throw NPE"); > } catch (NullPointerException e) { > System.out.println("PASSED"); > } > try { > Collections.synchronizedSet(set); > System.out.println("synchronizedSet(set) must throw NPE"); > } catch (NullPointerException e) { > System.out.println("PASSED"); > } > try { > Collections.synchronizedSortedSet(sortedset); > System.out.println("synchronizedSortedSet(null) must throw NPE"); > } catch (NullPointerException e) { > System.out.println("PASSED"); > } > try { > Collections.unmodifiableCollection(col); > System.out.println("unmodifiableCollection(null) must throw NPE"); > } catch (NullPointerException e) { > System.out.println("PASSED"); > } > try { > Collections.unmodifiableMap(map); > System.out.println("unmodifiableMap(null) must throw NPE"); > } catch (NullPointerException e) { > System.out.println("PASSED"); > } > try { > Collections.unmodifiableSet(set); > System.out.println("unmodifiableSet(null) must throw NPE"); > } catch (NullPointerException e) { > System.out.println("PASSED"); > } > try { > Collections.unmodifiableSortedMap(sortedmap); > System.out.println("unmodifiableSortedMap(null) must throw NPE"); > } catch (NullPointerException e) { > System.out.println("PASSED"); > } > try { > Collections.unmodifiableSortedSet(sortedset); > System.out.println("unmodifiableSortedSet(null) must throw NPE"); > } catch (NullPointerException e) { > System.out.println("PASSED"); > } > } > } > Steps to Reproduce: > 1. Build Harmony (check-out on 2006-01-30) j2se subset as described in README.txt. > 2. Compile test2.java using BEA 1.4 javac > > javac -d . test2.java > 3. Run java using compatible VM (J9) > > java -showversion test2 > Output: > C:\tmp>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test2 > java version "1.4.2_04" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05) > BEA WebLogic JRockit(TM) 1.4.2_04 JVM (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel) > PASSED > PASSED > PASSED > PASSED > PASSED > PASSED > PASSED > PASSED > PASSED > PASSED > C:\tmp>C:\harmony\trunk\deploy\jre\bin\java -showversion test2 > (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable. > synchronizedCollection(null) must throw NPE > synchronizedSortedMap(null) must throw NPE > synchronizedMap(map) must throw NPE > synchronizedSet(set) must throw NPE > synchronizedSortedSet(null) must throw NPE > unmodifiableCollection(null) must throw NPE > unmodifiableMap(null) must throw NPE > unmodifiableSet(null) must throw NPE > unmodifiableSortedMap(null) must throw NPE > unmodifiableSortedSet(null) must throw NPE > Suggected fix and test in attachment. -- 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