[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Potential bug in Hashtable
From: |
John Leuner |
Subject: |
Potential bug in Hashtable |
Date: |
Tue, 30 Oct 2001 11:27:56 -0800 (PST) |
I ran the latest classpath code against mauve, a
hashtable test which checks the size() after a clone()
failed:
I think copy.size should be set to 0 in the clone
method (before the putAll)?
With my JVM it prints out 28, the IBM JDK prints 14 as
expected by the mauve test.
public synchronized Object clone()
{
Hashtable copy = null;
try
{
copy = (Hashtable) super.clone();
}
catch (CloneNotSupportedException x)
{
// This is impossible.
}
copy.buckets = new HashEntry[buckets.length];
copy.putAll(this);
// Clear the caches.
copy.keys = null;
copy.values = null;
copy.entries = null;
return copy;
}
harness.checkPoint("Checking clone()");
Hashtable copy = (Hashtable) hash.clone();
hash.clear();
harness.check (hash.toString(), "{}");
harness.check (hash.size(), 0);
// harness.check (copy.toString());
System.out.println("copy.size() is " +
copy.size());
harness.check (copy.size(), 14);
John Leuner
__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Potential bug in Hashtable,
John Leuner <=