You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by va...@apache.org on 2006/11/14 11:20:21 UTC
svn commit: r474719 - in
/incubator/harmony/enhanced/classlib/trunk/modules/luni/src:
main/java/java/util/Hashtable.java
test/java/tests/api/java/util/HashtableTest.java
Author: varlax
Date: Tue Nov 14 02:20:20 2006
New Revision: 474719
URL: http://svn.apache.org/viewvc?view=rev&rev=474719
Log:
Applied HARMONY-2181 [classlib][luni]Property fails to remove entry by iteration.
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/HashtableTest.java
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java?view=diff&rev=474719&r1=474718&r2=474719
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Hashtable.java Tue Nov 14 02:20:20 2006
@@ -186,7 +186,7 @@
entry = entry.next;
}
if (entry != null) {
- entry = lastEntry.next;
+ entry.next = lastEntry.next;
removed = true;
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/HashtableTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/HashtableTest.java?view=diff&rev=474719&r1=474718&r2=474719
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/HashtableTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/HashtableTest.java Tue Nov 14 02:20:20 2006
@@ -633,6 +633,28 @@
"Removing from the values collection should remove from the original map",
!myHashtable.containsValue(new Integer(0)));
}
+
+ /**
+ * Regression Test for JIRA 2181
+ */
+ public void test_entrySet_remove()
+ {
+ Hashtable<String,String> hashtable = new Hashtable<String,String>();
+ hashtable.put("my.nonexistent.prop", "AAA");
+ hashtable.put( "parse.error", "BBB" );
+ Iterator<Map.Entry<String,String>> iterator =
+ hashtable.entrySet().iterator();
+ while(iterator.hasNext())
+ {
+ Map.Entry entry = iterator.next();
+ final Object value = entry.getValue();
+ if(value.equals("AAA"))
+ {
+ iterator.remove();
+ }
+ }
+ assertFalse(hashtable.containsKey("my.nonexistent.prop"));
+ }
protected Hashtable hashtableClone(Hashtable s) {
return (Hashtable) s.clone();