You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by "Vladimir Strigun (JIRA)" <ji...@apache.org> on 2006/01/20 17:36:42 UTC
[jira] Created: (HARMONY-37) remove() method of IdentityHashMap
works incorrectly
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
[jira] Assigned: (HARMONY-37) remove() method of IdentityHashMap
works incorrectly
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-37?page=all ]
Tim Ellison reassigned HARMONY-37:
----------------------------------
Assign To: Tim Ellison
> 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
> Assignee: Tim Ellison
> Attachments: IdentityHashMapTest.java
>
> 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
[jira] Commented: (HARMONY-37) remove() method of IdentityHashMap
works incorrectly
Posted by "Vladimir Strigun (JIRA)" <ji...@apache.org>.
[ 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
[jira] Updated: (HARMONY-37) remove() method of IdentityHashMap
works incorrectly
Posted by "Vladimir Strigun (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-37?page=all ]
Vladimir Strigun updated HARMONY-37:
------------------------------------
Attachment: IdentityHashMapTest.java
test was updated
> 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
> Assignee: Tim Ellison
> Attachments: IdentityHashMapTest.java, IdentityHashMapTest.java
>
> 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
[jira] Resolved: (HARMONY-37) remove() method of IdentityHashMap
works incorrectly
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-37?page=all ]
Tim Ellison resolved HARMONY-37:
--------------------------------
Resolution: Fixed
Thanks Vladimir.
I've included your extra tests, and they pass ok now.
Fixed in text module java/util/IdentityHashMap.java at repo revision 371027.
Please verify that it fully resolves your problem.
> 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
> Assignee: Tim Ellison
> Attachments: IdentityHashMapTest.java, IdentityHashMapTest.java
>
> 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
[jira] Commented: (HARMONY-37) remove() method of IdentityHashMap
works incorrectly
Posted by "Vladimir Strigun (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-37?page=comments#action_12363416 ]
Vladimir Strigun commented on HARMONY-37:
-----------------------------------------
I'll attach regression test for this bug. Here is diff for /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/org/apache/harmony/tests/java/util/AllTests.java :
32a33
> suite.addTestSuite(IdentityHashMapTest.class);
> 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
[jira] Updated: (HARMONY-37) remove() method of IdentityHashMap
works incorrectly
Posted by "Vladimir Strigun (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-37?page=all ]
Vladimir Strigun updated HARMONY-37:
------------------------------------
Attachment: IdentityHashMapTest.java
regression test
> 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
> Attachments: IdentityHashMapTest.java
>
> 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
[jira] Commented: (HARMONY-37) remove() method of IdentityHashMap
works incorrectly
Posted by "Vladimir Strigun (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-37?page=comments#action_12363586 ]
Vladimir Strigun commented on HARMONY-37:
-----------------------------------------
Tim, thanks for the fix. Everything works fine.
> 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
> Assignee: Tim Ellison
> Attachments: IdentityHashMapTest.java, IdentityHashMapTest.java
>
> 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
[jira] Commented: (HARMONY-37) remove() method of IdentityHashMap
works incorrectly
Posted by "Vladimir Strigun (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-37?page=comments#action_12363468 ]
Vladimir Strigun commented on HARMONY-37:
-----------------------------------------
Ya, I've already found it. I'll update test and try to update the fix :)
> 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
> Assignee: Tim Ellison
> Attachments: IdentityHashMapTest.java
>
> 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
[jira] Commented: (HARMONY-37) remove() method of IdentityHashMap
works incorrectly
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-37?page=comments#action_12363462 ]
Tim Ellison commented on HARMONY-37:
------------------------------------
Vladimir,
Good test -- thanks. ... and it's worse than that, the IdentityHashMap does not deal with 'null' keys and values properly.
Will take a look at it.
> 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
> Assignee: Tim Ellison
> Attachments: IdentityHashMapTest.java
>
> 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
[jira] Closed: (HARMONY-37) remove() method of IdentityHashMap
works incorrectly
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-37?page=all ]
Tim Ellison closed HARMONY-37:
------------------------------
Verified by Vladimir.
> 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
> Assignee: Tim Ellison
> Attachments: IdentityHashMapTest.java, IdentityHashMapTest.java
>
> 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