harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Strigun (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-37) remove() method of IdentityHashMap works incorrectly
Date Fri, 20 Jan 2006 16:42:42 GMT
    [ http://issues.apache.org/jira/browse/HARMONY-37?page=comments#action_12363414 ] 

Vladimir Strigun commented on HARMONY-37:
-----------------------------------------

To fix it, we just need to check wheather this key exist in hashmap (i.e check that key is
not null and key exist in elementData array). The patch is very simple:
444c444
<               if (result == null && key == null)
---
>               if (result == null && key == null || key!=null && elementData[index]
!= key)

> remove() method of IdentityHashMap works incorrectly
> ----------------------------------------------------
>
>          Key: HARMONY-37
>          URL: http://issues.apache.org/jira/browse/HARMONY-37
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Vladimir Strigun

>
> When user try to remove unexisting key from empty hashmap, size of object decreased to
-1.
> Testcase for reproducing:
> import java.util.IdentityHashMap;
> public class Harmony37 {
>     public static void main(String args[]) {
>         IdentityHashMap hashMap = new IdentityHashMap();
>         hashMap.remove("unexist");
>         if (hashMap.size() != 0) {
>             System.out.println("FAILED, because size="+hashMap.size());
>         }
>     }
> }

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