[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [patch] Re: HashMap putAll/putAllInternal bug
From: |
Stuart Ballard |
Subject: |
Re: [patch] Re: HashMap putAll/putAllInternal bug |
Date: |
Thu, 25 Sep 2003 15:51:03 -0400 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3.1) Gecko/20030527 Debian/1.3.1-2 |
Dalibor Topic wrote:
Not attached here ;)
I already resent it but just in case that didn't make it through, I've
re-attached it here.
Could you give it spin on kaffe from CVS? It uses Classpath's collection
classes.
It applies cleanly to Kaffe CVS (of course) and passes all 144 "make
check" tests; I also confirmed that it does have the desired behavior of
allowing nrdo's first pass to run unmodified on Kaffe and generate
correct results. If this gets accepted (and barring any problems in the
second phase, which is mostly pretty simple JDBC) I can put nrdo on
Savannah! Woo!
Stuart.
--
Stuart Ballard, Senior Web Developer
FASTNET - Web Solutions
(215) 283-2300, ext. 126
www.fast.net
Index: HashMap.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/HashMap.java,v
retrieving revision 1.24
diff -u -r1.24 HashMap.java
--- HashMap.java 1 Aug 2003 03:31:32 -0000 1.24
+++ HashMap.java 25 Sep 2003 18:16:52 -0000
@@ -381,8 +381,7 @@
public void putAll(Map m)
{
Iterator itr = m.entrySet().iterator();
- int msize = m.size();
- while (msize-- > 0)
+ while (itr.hasNext())
{
Map.Entry e = (Map.Entry) itr.next();
// Optimize in case the Entry is one of our own.
@@ -709,10 +708,10 @@
void putAllInternal(Map m)
{
Iterator itr = m.entrySet().iterator();
- int msize = m.size();
- size = msize;
- while (msize-- > 0)
+ size = 0;
+ while (itr.hasNext())
{
+ size++;
Map.Entry e = (Map.Entry) itr.next();
Object key = e.getKey();
int idx = hash(key);
Index: Hashtable.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/Hashtable.java,v
retrieving revision 1.28
diff -u -r1.28 Hashtable.java
--- Hashtable.java 7 May 2002 05:13:05 -0000 1.28
+++ Hashtable.java 25 Sep 2003 18:16:52 -0000
@@ -510,7 +510,7 @@
{
Iterator itr = m.entrySet().iterator();
- for (int msize = m.size(); msize > 0; msize--)
+ while (itr.hasNext())
{
Map.Entry e = (Map.Entry) itr.next();
// Optimize in case the Entry is one of our own.
@@ -859,11 +859,11 @@
void putAllInternal(Map m)
{
Iterator itr = m.entrySet().iterator();
- int msize = m.size();
- this.size = msize;
+ size = 0;
- for (; msize > 0; msize--)
+ while (itr.hasNext())
{
+ size++;
Map.Entry e = (Map.Entry) itr.next();
Object key = e.getKey();
int idx = hash(key);
[really patch] Re: HashMap putAll/putAllInternal bug, Stuart Ballard, 2003/09/25