[jboss-svn-commits] JBL Code SVN: r10814 - labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sat Apr 7 20:50:18 EDT 2007


Author: mark.proctor at jboss.com
Date: 2007-04-07 20:50:18 -0400 (Sat, 07 Apr 2007)
New Revision: 10814

Modified:
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/RuleTerminalNode.java
Log:
JBRULES-780 no-loop results in NullPointer in RuleTerminalNode.retractTuple
-went with a tuple == null check for now, although I worry this might hide future errors

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/RuleTerminalNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/RuleTerminalNode.java	2007-04-08 00:49:13 UTC (rev 10813)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/RuleTerminalNode.java	2007-04-08 00:50:18 UTC (rev 10814)
@@ -141,8 +141,7 @@
             return;
         }
 
-        // if the current Rule is no-loop and the origin rule is the same then
-        // return
+        // if the current Rule is no-loop and the origin rule is the same then return
         if ( this.rule.getNoLoop() && this.rule.equals( context.getRuleOrigin() ) ) {
             return;
         }
@@ -262,6 +261,11 @@
                              final InternalWorkingMemory workingMemory) {
         final TerminalNodeMemory memory = (TerminalNodeMemory) workingMemory.getNodeMemory( this );
         final ReteTuple tuple = (ReteTuple) memory.getTupleMemory().remove( leftTuple );
+        if ( tuple == null ) {
+        	// tuple should only be null if it was asserted and reached a no-loop causing it to exit early
+            // before being added to the node memory and an activation created and attached
+        	return;
+        }
         final Activation activation = tuple.getActivation();
         if ( activation.isActivated() ) {
             activation.remove();




More information about the jboss-svn-commits mailing list