[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()

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;
        copy = (Hashtable) super.clone();
    catch (CloneNotSupportedException x)
        // This is impossible.
    copy.buckets = new HashEntry[buckets.length];
    // Clear the caches.
    copy.keys = null;
    copy.values = null;
    copy.entries = null;
    return copy;

  harness.checkPoint("Checking clone()");
      Hashtable copy = (Hashtable) hash.clone();
      harness.check (hash.toString(), "{}");
      harness.check (hash.size(), 0);
      // harness.check (copy.toString());
      System.out.println("copy.size() is " +
      harness.check (copy.size(), 14);

John Leuner

Do You Yahoo!?
Make a great connection at Yahoo! Personals.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]