You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Paulex Yang (JIRA)" <ji...@apache.org> on 2006/03/28 08:22:19 UTC
[jira] Created: (HARMONY-262) java.util.Hashtable, same as HashMap,
has similar non-compatible behavior with RI
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
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
[jira] Assigned: (HARMONY-262) java.util.Hashtable, same as
HashMap, has similar non-compatible behavior with RI
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ 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
[jira] Updated: (HARMONY-262) java.util.Hashtable, same as HashMap,
has similar non-compatible behavior with RI
Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-262?page=all ]
Paulex Yang updated HARMONY-262:
--------------------------------
Attachment: JIRA262.patch
This patch should fix this issue in same way as JIRA 206, by caching the hash value of key in the Entry of Hashtable
> 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
> 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
[jira] Commented: (HARMONY-262) java.util.Hashtable, same as
HashMap, has similar non-compatible behavior with RI
Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-262?page=comments#action_12372191 ]
Paulex Yang commented on HARMONY-262:
-------------------------------------
the new revision looks fine. thank you, Tim.
> 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
[jira] Resolved: (HARMONY-262) java.util.Hashtable, same as
HashMap, has similar non-compatible behavior with RI
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-262?page=all ]
Tim Ellison resolved HARMONY-262:
---------------------------------
Resolution: Fixed
Thanks Paulex,
Patch looks good, applied to LUNI module java.util.Hashtable at repo revision 389451.
Please check that the patch was applied as you expected.
> 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
[jira] Closed: (HARMONY-262) java.util.Hashtable, same as HashMap,
has similar non-compatible behavior with RI
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-262?page=all ]
Tim Ellison closed HARMONY-262:
-------------------------------
Verified by Paulex
> 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