[jboss-svn-commits] JBL Code SVN: r32047 - 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
Thu Mar 11 18:53:18 EST 2010


Author: tirelli
Date: 2010-03-11 18:53:18 -0500 (Thu, 11 Mar 2010)
New Revision: 32047

Modified:
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/AccumulateNode.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/CollectNode.java
Log:
JBRULES-2339: JBRULES-2440: fixing NPE

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/AccumulateNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/AccumulateNode.java	2010-03-11 23:48:55 UTC (rev 32046)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/AccumulateNode.java	2010-03-11 23:53:18 UTC (rev 32047)
@@ -577,12 +577,11 @@
             this.resultBinder.resetTuple( memory.resultsContext );
         }
 
-        // temporarily break the linked list to avoid wrong interactions
-        LeftTuple[] matchings = splitList( leftTuple,
-                                           accctx,
-                                           false );
-
         if ( accctx.propagated == true ) {
+            // temporarily break the linked list to avoid wrong interactions
+            LeftTuple[] matchings = splitList( leftTuple,
+                                               accctx,
+                                               false );
             if ( isAllowed ) {
                 // modify 
                 if ( ActivitySource.LEFT.equals( source ) ) {
@@ -605,22 +604,26 @@
                                                      workingMemory );
                 accctx.propagated = false;
             }
-        } else {
-            if ( isAllowed ) {
-                // assert
-                this.sink.propagateAssertLeftTuple( leftTuple,
-                                                    accctx.result,
-                                                    context,
-                                                    workingMemory,
-                                                    this.tupleMemoryEnabled );
-                accctx.propagated = true;
-            }
+            // restore the matchings list
+            restoreList( leftTuple,
+                         matchings );
+        } else if ( isAllowed ) {
+            // temporarily break the linked list to avoid wrong interactions
+            LeftTuple[] matchings = splitList( leftTuple,
+                                               accctx,
+                                               false );
+            // assert
+            this.sink.propagateAssertLeftTuple( leftTuple,
+                                                accctx.result,
+                                                context,
+                                                workingMemory,
+                                                this.tupleMemoryEnabled );
+            accctx.propagated = true;
+            // restore the matchings list
+            restoreList( leftTuple,
+                         matchings );
         }
 
-        // restore the matchings list
-        restoreList( leftTuple,
-                     matchings );
-
     }
 
     public void updateSink(final LeftTupleSink sink,

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/CollectNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/CollectNode.java	2010-03-11 23:48:55 UTC (rev 32046)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/CollectNode.java	2010-03-11 23:53:18 UTC (rev 32047)
@@ -546,12 +546,12 @@
             this.resultsBinder.resetTuple( memory.resultsContext );
         }
 
-        // temporarily break the linked list to avoid wrong interactions
-        LeftTuple[] matchings = splitList( leftTuple,
-                                           colctx,
-                                           false );
+        if ( colctx.propagated == true ) {
+            // temporarily break the linked list to avoid wrong interactions
+            LeftTuple[] matchings = splitList( leftTuple,
+                                               colctx,
+                                               false );
 
-        if ( colctx.propagated == true ) {
             if ( isAllowed ) {
                 // modify 
                 if ( ActivitySource.LEFT.equals( source ) ) {
@@ -574,21 +574,26 @@
                                                      workingMemory );
                 colctx.propagated = false;
             }
-        } else {
-            if ( isAllowed ) {
-                // assert
-                this.sink.propagateAssertLeftTuple( leftTuple,
-                                                    colctx.resultTuple,
-                                                    context,
-                                                    workingMemory,
-                                                    this.tupleMemoryEnabled );
-                colctx.propagated = true;
-            }
+            // restore the matchings list
+            restoreList( leftTuple,
+                         matchings );
+        } else if ( isAllowed ) {
+            // temporarily break the linked list to avoid wrong interactions
+            LeftTuple[] matchings = splitList( leftTuple,
+                                               colctx,
+                                               false );
+
+            // assert
+            this.sink.propagateAssertLeftTuple( leftTuple,
+                                                colctx.resultTuple,
+                                                context,
+                                                workingMemory,
+                                                this.tupleMemoryEnabled );
+            colctx.propagated = true;
+            // restore the matchings list
+            restoreList( leftTuple,
+                         matchings );
         }
-
-        // restore the matchings list
-        restoreList( leftTuple,
-                     matchings );
     }
 
     /**



More information about the jboss-svn-commits mailing list