[
https://issues.jboss.org/browse/JBRULES-2887?page=com.atlassian.jira.plug...
]
Wolfgang Laun commented on JBRULES-2887:
----------------------------------------
The NPE can be avoided by testing accctx != null in retractLeftTuple and avoid calling
removePreviousMatchesForLeftTuple and executing the if statement. But this method calls
other methods, and it's not clear to me whether this would skip some essential
activity.
Also, it could be that the returned value shouldn't be null at all, and so s.th. else
is broken.
AccumulateNode runs into NPE
----------------------------
Key: JBRULES-2887
URL:
https://issues.jboss.org/browse/JBRULES-2887
Project: Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: drools-core
Affects Versions: 5.1.1.FINAL
Reporter: Wolfgang Laun
Assignee: Mark Proctor
Fix For: 5.2.0.M1
A rule such as
rule "average"
when
B( id < 10 )
$list: List() from collect ( A() over window:time(10s) )
Number( $avg: doubleValue ) from accumulate( A( $id : id ) from $list,
average( $id ) )
then
System.out.println( "average = " + $avg );
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.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira