cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/collections SimpleHashtable.java

2001-08-30 Thread costin

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  ChangesPath
  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 Entrycurrent = 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  0x7FFF) % 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 );
   }
   }
  
  
  



RE: cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/collections SimpleHashtable.java

2001-08-30 Thread Martin van den Bemt

Since I was very busy lately (still am), could this be the thing that solves
my reladoing problem and the Application state not ready after that ?
I will test it somewhere next week, just to be sure, but it doesn't hurt to
ask..

Mvgr,
Martin

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 30, 2001 10:41 PM
 To: [EMAIL PROTECTED]
 Subject: cvs commit:
 jakarta-tomcat/src/share/org/apache/tomcat/util/collections
 SimpleHashtable.java


 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  ChangesPath
   1.6   +15 -5
 jakarta-tomcat/src/share/org/apache/tomcat/util/collections/Simple
 Hashtable.java

   Index: SimpleHashtable.java
   ===
   RCS file:
 /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/collecti
 ons/SimpleHashtable.java,v
   retrieving revision 1.5
   retrieving revision 1.6
   diff -u -r1.5 -r1.6
   --- SimpleHashtable.java2001/08/29 05:08:40 1.5
   +++ SimpleHashtable.java2001/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 intcurrentBucket = 0;

   +// number of elements in hashtable
private intcount;
private intthreshold;

   @@ -317,18 +318,22 @@
   Entry prev=null;
   int hash = key.hashCode();
   int index = (hash  0x7FFF) % 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 );
}
}








cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/collections SimpleHashtable.java

2001-08-28 Thread costin

costin  01/08/28 22:08:40

  Modified:src/share/org/apache/tomcat/util/collections
SimpleHashtable.java
  Log:
  Small fix in SimpleHashtable, we can have calls to nextElement without hasMore.
  
  Revision  ChangesPath
  1.5   +5 -1  
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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SimpleHashtable.java  2001/07/19 05:50:46 1.4
  +++ SimpleHashtable.java  2001/08/29 05:08:40 1.5
  @@ -97,7 +97,7 @@
* it makes a significant difference when normalizing attributes,
* which is done for each start-element construct.
*
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
*/
   public final class SimpleHashtable implements Enumeration
   {
  @@ -166,6 +166,7 @@
   public Enumeration keys() {
currentBucket = 0;
current = null;
  + hasMoreElements();
return this;
   }
   
  @@ -197,6 +198,9 @@
throw new IllegalStateException ();
retval = current.key;
current = current.next;
  + // Advance to the next position ( we may call next after next,
  + // without hasMore )
  + hasMoreElements();
return retval;
   }
   
  
  
  



cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/collections SimpleHashtable.java

2000-12-27 Thread costin

costin  00/12/27 13:23:18

  Modified:src/share/org/apache/tomcat/util/collections
SimpleHashtable.java
  Log:
  Added the missing remove() method.
  
  Revision  ChangesPath
  1.2   +20 -3 
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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SimpleHashtable.java  2000/11/30 17:34:17 1.1
  +++ SimpleHashtable.java  2000/12/27 21:23:17 1.2
  @@ -97,7 +97,7 @@
* it makes a significant difference when normalizing attributes,
* which is done for each start-element construct.
*
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
*/
   public final class SimpleHashtable implements Enumeration
   {
  @@ -308,8 +308,25 @@
return null;
   }
   
  -public void remove(Object o) {
  - 
  +public Object remove(Object key) {
  + Entry tab[] = table;
  + Entry prev=null;
  + int hash = key.hashCode();
  + int index = (hash  0x7FFF) % tab.length;
  + for (Entry e = tab[index] ; e != null ; prev=e, e = e.next) {
  + if ((e.hash == hash)  e.key.equals(key)) {
  + if( prev!=null ) {
  + prev.next=e.next;
  + } else {
  + tab[index]=e.next;
  + }
  + }
  + count--;
  + Object res=e.value;
  + e.value=null;
  + return res;
  + }
  + return null;
   }
   
   /**