You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Tim Ellison (JIRA)" <ji...@apache.org> on 2006/03/28 11:25:21 UTC
[jira] Assigned: (HARMONY-262) java.util.Hashtable, same as
HashMap, has similar non-compatible behavior with RI
[ http://issues.apache.org/jira/browse/HARMONY-262?page=all ]
Tim Ellison reassigned HARMONY-262:
-----------------------------------
Assign To: Tim Ellison
> java.util.Hashtable, same as HashMap, has similar non-compatible behavior with RI
> ---------------------------------------------------------------------------------
>
> Key: HARMONY-262
> URL: http://issues.apache.org/jira/browse/HARMONY-262
> Project: Harmony
> Type: Bug
> Components: Classlib
> Reporter: Paulex Yang
> Assignee: Tim Ellison
> Attachments: JIRA262.patch
>
> Same situation with the prior HashMap issue(http://issues.apache.org/jira/browse/HARMONY-206), the Hashtable is non-compatible with RI when key is reused with different hash.
> Following test case show the non-compatiblity, it passes on RI but fails on Harmony.
> public class HashTableTest extends extends junit.framework.TestCase{
> public void test_getLjava_lang_Object() {
> ReusableKey k = new ReusableKey();
> Hashtable h2 = new Hashtable();
> k.setKey(1);
> h2.put(k, "value1");
> k.setKey(13);
> assertNull(h2.get(k));
> k.setKey(12);
> assertNull(h2.get(k));
> }
> static class ReusableKey {
> private int key = 0;
> public void setKey(int key) {
> this.key = key;
> }
> public int hashCode() {
> return key;
> }
> public boolean equals(Object o) {
> if (o == this) {
> return true;
> }
> if (!(o instanceof ReusableKey)) {
> return false;
> }
> return key == ((ReusableKey) o).key;
> }
> }
> }
--
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