Another HashTable fix.

stephen clawson sclawson at fast.cs.utah.edu
Tue Sep 29 16:13:11 PDT 1998


      Here's another fix to HashTable.  This time it's the clone
function.  In this case, the || should be a &&, otherwise it attempts
to put all the keys into the new HashTable, including the `free' ones,
which are signified by a null reference.  This of course ends with a
NullPointerException in HashTable.put when it tries to call
calculateBucket.


steve


Index: Hashtable.java
===================================================================
RCS file:
/home/cvspublic/kaffe/libraries/javalib/java/util/Hashtable.java,v
retrieving revision 1.7
diff -u -r1.7 Hashtable.java
--- Hashtable.java      1998/09/26 09:50:25     1.7
+++ Hashtable.java      1998/09/29 23:06:34
@@ -256,7 +256,7 @@
 
     /* copy our entries in new hashtable */ 
     for (int pos = keys.length-1; pos >= 0; pos--) {
-      if (keys[pos] != free || keys[pos] != removed) {
+      if (keys[pos] != free && keys[pos] != removed) {
        result.put(keys[pos], elements[pos]);
       }
     }


-- 
// stephen clawson				sclawson at cs.utah.edu
// university of utah			        



More information about the kaffe mailing list