costin 01/08/30 13:40:51 Modified: src/share/org/apache/tomcat/util/collections SimpleHashtable.java Log: Fix an error in SimpleHashtable.remove, that caused problems in reloading. ( also added few more debug statements ) Revision Changes Path 1.6 +15 -5 jakarta-tomcat/src/share/org/apache/tomcat/util/collections/SimpleHashtable.java Index: SimpleHashtable.java =================================================================== RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/collections/SimpleHashtable.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- SimpleHashtable.java 2001/08/29 05:08:40 1.5 +++ SimpleHashtable.java 2001/08/30 20:40:51 1.6 @@ -97,7 +97,7 @@ * it makes a significant difference when normalizing attributes, * which is done for each start-element construct. * - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ */ public final class SimpleHashtable implements Enumeration { @@ -108,6 +108,7 @@ private Entry current = null; private int currentBucket = 0; + // number of elements in hashtable private int count; private int threshold; @@ -317,18 +318,22 @@ Entry prev=null; int hash = key.hashCode(); int index = (hash & 0x7FFFFFFF) % tab.length; + if( dL > 0 ) d("Idx " + index + " " + tab[index] ); for (Entry e = tab[index] ; e != null ; prev=e, e = e.next) { + if( dL > 0 ) d("> " + prev + " " + e.next + " " + e + " " + e.key); if ((e.hash == hash) && e.key.equals(key)) { if( prev!=null ) { prev.next=e.next; } else { tab[index]=e.next; } + if( dL > 0 ) d("Removing from list " + tab[index] + " " + prev + + " " + e.value); + count--; + Object res=e.value; + e.value=null; + return res; } - count--; - Object res=e.value; - e.value=null; - return res; } return null; } @@ -348,5 +353,10 @@ this.value = value; this.next = next; } + } + + private static final int dL=0; + private void d(String s ) { + System.err.println( "SimpleHashtable: " + s ); } }