Bug 724701 (BRMS-580)

Summary: AccumulateNode runs into NPE
Product: [JBoss] JBoss Enterprise BRMS Platform 5 Reporter: Alessandro Lazarotti <alazarot>
Component: BRE (Expert, Fusion)Assignee: Tihomir Surdilovic <tsurdilo>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: urgent    
Version: 5.1.0 GA, 5.1.0.PostGACC: alazarot, jkrupka, tsurdilo
Target Milestone: ---   
Target Release: 5.1.0.PostGA   
Hardware: Unspecified   
OS: Unspecified   
URL: http://jira.jboss.org/jira/browse/BRMS-580
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-04-14 21:48:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
DroolsTest.java
none
JB2887.zip
none
SampleAlarmRules.drl none

Description Alessandro Lazarotti 2011-04-12 18:25:23 UTC
Help Desk Ticket Reference: https://c.na7.visual.force.com/apex/Case_View?id=500A00000078xLk&sfdc.override=1
Steps to Reproduce: Execute the project JB2887.zip attached with this Jira case
securitylevel_name: Public

A rule such as
rule "MESSAGE_FINE"
salience 2
	when
		
		Message (value == "FINE")
		
		$listHolder : ListHolder()
				
		$coll1:ArrayList()
              from collect(Object() from $listHolder.getList())      
		$coll2:ArrayList()
              from collect(Object() from $listHolder.getList())
	then
	System.out.println("Exceuting rule");	
end

rule "MESSAGE_HELLO"
salience 1
	when
		msg : Message(value != "HELLO" )
	then
		msg.setValue("HELLO");
		update(msg);
		System.out.println("Message: "+msg.getValue());		
end

runs into a NPE

Caused by: java.lang.NullPointerException
	at org.drools.reteoo.AccumulateNode.getFirstMatch(AccumulateNode.java:967)
	at org.drools.reteoo.AccumulateNode.splitList(AccumulateNode.java:920)
	at org.drools.reteoo.AccumulateNode.removePreviousMatchesForLeftTuple(AccumulateNode.java:874)
	at org.drools.reteoo.AccumulateNode.retractLeftTuple(AccumulateNode.java:205)
	at org.drools.reteoo.CompositeLeftTupleSinkAdapter.doPropagateRetractLeftTuple(CompositeLeftTupleSinkAdapter.java:238)
	at org.drools.reteoo.CompositeLeftTupleSinkAdapter.propagateRetractLeftTupleDestroyRightTuple(CompositeLeftTupleSinkAdapter.java:138)
	at org.drools.reteoo.AccumulateNode.retractLeftTuple(AccumulateNode.java:212)
	at org.drools.reteoo.ModifyPreviousTuples.retractTuples(ModifyPreviousTuples.java:111)
	at org.drools.reteoo.EntryPointNode.modifyObject(EntryPointNode.java:176)
	at org.drools.common.NamedEntryPoint.update(NamedEntryPoint.java:450)
	at org.drools.common.NamedEntryPoint.update(NamedEntryPoint.java:361)
	at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:183)
	at org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:196)
	at event.Rule_launch_0.defaultConsequence(Rule_launch_0.java:7)
	at event.Rule_launch_0DefaultConsequenceInvoker.evaluate(Rule_launch_0DefaultConsequenceInvoker.java:33)
	at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:913)


A null Parameter accctx is passed down from retractLeftTuple.

Comment 1 Alessandro Lazarotti 2011-04-12 18:25:23 UTC
Link: Added: This issue Cloned from JBRULES-2887


Comment 2 Alessandro Lazarotti 2011-04-12 18:31:29 UTC
Help Desk Ticket Reference: Added: https://c.na7.visual.force.com/apex/Case_View?id=500A00000078xLk&sfdc.override=1
Steps to Reproduce: Removed: Notice that the initial pattern B(...) is essential for reproducing the issue, because it is this pattern terminating the match that triggers the NPE. Added: Execute the project JB2887.zip attached with this Jira case


Comment 3 Alessandro Lazarotti 2011-04-12 18:41:59 UTC
the same project works in BRMS 5.0.x

Comment 4 Tihomir Surdilovic 2011-04-14 21:47:57 UTC
merged changes into the BRMS 5.1.x branch