harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paulex Yang (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (HARMONY-839) [classlib][util]WeakHashMap(Map arg) throws NPE if arg.entrySet() returns null
Date Mon, 18 Sep 2006 10:22:24 GMT
     [ http://issues.apache.org/jira/browse/HARMONY-839?page=all ]

Paulex Yang resolved HARMONY-839.
---------------------------------

    Resolution: Fixed

Anton and Spark, updated patch applied at revision r447357, thanks a lot for this enhancement,
please verify the problem is fixed as you expected.

> [classlib][util]WeakHashMap(Map arg) throws NPE if arg.entrySet() returns null
> ------------------------------------------------------------------------------
>
>                 Key: HARMONY-839
>                 URL: http://issues.apache.org/jira/browse/HARMONY-839
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Windows XP
>            Reporter: Anton Luht
>         Assigned To: Paulex Yang
>            Priority: Trivial
>         Attachments: harmony-839.diff, identity_hash_map_patch.txt, patch.txt
>
>
> VM + Classlib version 420749
> Problem:
> If we create a Map with entrySet() method that return null, WeakHashMap constructor with
it won't throw NPE in RI but will in Harmony.
> Code to reproduce:
> import java.util.*;
> public class Test  {
>  public static void main (String[] args) {                 
>           Map localMap = new TestMap();
>           new WeakHashMap(localMap);
>     } 
> } 
> class TestMap implements Map {
>                         public void clear() {
>                                     return;
>                         }
>                         public boolean containsKey(Object p0) {
>                                     return false;
>                         }
>                         public boolean containsValue(Object p0) {
>                                     return false;
>                         }
>                         public Set entrySet() {
>                                     return null;
>                         }
>                         public boolean equals(Object p0) {
>                                     return false;
>                         }
>                         public Object get(Object p0) {
>                                     return null;
>                         }
>                         public int hashCode() {
>                                     return 0;
>                         }
>                         public boolean isEmpty() {
>                                     return false;
>                         }
>                         public Set keySet() {
>                                     return null;
>                         }
>                         public Object put(Object p0, Object p1) {
>                                     return null;
>                         }
>                         public void putAll(Map p0) {
>                                     return;
>                         }
>                         public Object remove(Object p0) {
>                                     return null;
>                         }
>                         public int size() {
>                                     return 0;
>                         }
>                         public Collection values() {
>                                     return null;
>                         }
>             }
> Output in RI: none
> Output in Harmony:
> java.lang.NullPointerException
>         at java.util.AbstractMap.putAll(AbstractMap.java:282)
>         at java.util.WeakHashMap.<init>(WeakHashMap.java:231)
>         at Test.main(Test.java:5)
> Please see the unit test for this issue + patch to fix it attached

-- 
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

        

Mime
View raw message