harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anton Luht (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-839) WeakHashMap(Map arg) throws NPE if arg.entrySet() returns null
Date Mon, 17 Jul 2006 14:41:14 GMT
     [ http://issues.apache.org/jira/browse/HARMONY-839?page=all ]

Anton Luht updated HARMONY-839:
-------------------------------

    Attachment: identity_hash_map_patch.txt

same problem with IdentityHashMap - attaching patch with JUnit test and fix for classlib code

> 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: Non-bug differences from RI
>         Environment: Windows XP
>            Reporter: Anton Luht
>            Priority: Trivial
>         Attachments: 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