[jboss-svn-commits] JBL Code SVN: r18647 - labs/jbossrules/branches/4.0.x/drools-core/src/main/java/org/drools/util.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Feb 29 18:52:57 EST 2008


Author: tirelli
Date: 2008-02-29 18:52:57 -0500 (Fri, 29 Feb 2008)
New Revision: 18647

Modified:
   labs/jbossrules/branches/4.0.x/drools-core/src/main/java/org/drools/util/FactHandleIndexHashTable.java
Log:
JBRULES-1492: fixing additional bug when removing elements from hash table

Modified: labs/jbossrules/branches/4.0.x/drools-core/src/main/java/org/drools/util/FactHandleIndexHashTable.java
===================================================================
--- labs/jbossrules/branches/4.0.x/drools-core/src/main/java/org/drools/util/FactHandleIndexHashTable.java	2008-02-29 21:28:45 UTC (rev 18646)
+++ labs/jbossrules/branches/4.0.x/drools-core/src/main/java/org/drools/util/FactHandleIndexHashTable.java	2008-02-29 23:52:57 UTC (rev 18647)
@@ -165,19 +165,20 @@
             final FieldIndexEntry next = (FieldIndexEntry) current.next;
             if ( current.matches( object,
                                   hashCode ) ) {
-                current.remove( handle );
-                this.factSize--;
-                // If the FactEntryIndex is empty, then remove it from the hash table
-                if ( current.first == null ) {
-                    if ( previous == current ) {
-                        this.table[index] = next;
-                    } else {
-                        previous.next = next;
+                if( current.remove( handle ) != null) {
+                    this.factSize--;
+                    // If the FactEntryIndex is empty, then remove it from the hash table
+                    if ( current.first == null ) {
+                        if ( previous == current ) {
+                            this.table[index] = next;
+                        } else {
+                            previous.next = next;
+                        }
+                        current.next = null;
+                        this.size--;
                     }
-                    current.next = null;
-                    this.size--;
+                    return true;
                 }
-                return true;
             }
             previous = current;
             current = next;




More information about the jboss-svn-commits mailing list