[rules-users] NullPointerException using 2 sliding windows and accumulate functions.
nw1005
netwalker10015 at gmail.com
Wed Jul 3 04:10:05 EDT 2013
Hello everybody,
currently I'm facing a problem using sliding windows and accumulate feature
in Drools 5.5.0.Final.
I'm using two sliding windows (window:length) with different lengths on the
same event in the same rule.
It seems that the shorter window retracts events which are not fitting in it
any more,
and accumulate function over the bigger window tries to access the retracted
event with a NullPointerException.
declare Property
@role(event)
@timestamp(measuretime)
end
rule "Buggy rule"
when
Number(doubleValue > 10) from accumulate(Property(propertyname ==
"PROPERTY1", val16: propertyvalue) over window:length(2)
from entry-point "123" , max(val16))
Number(doubleValue < 50) from accumulate(Property(propertyname ==
"PROPERTY1", val20: propertyvalue) over window:length(5)
from entry-point "123" , max(val20))
then
System.out.println("Rule Match");
end
entryPoint.insert(new Property("PROPERTY1", 20));
session.fireAllRules();
entryPoint.insert(new Property("PROPERTY1", 20));
session.fireAllRules();
entryPoint.insert(new Property("PROPERTY1", 20));
session.fireAllRules();
entryPoint.insert(new Property("PROPERTY1", 2));
session.fireAllRules();
entryPoint.insert(new Property("PROPERTY1", 2));
session.fireAllRules();
entryPoint.insert(new Property("PROPERTY1", 2));
It happens on the last insert.
java.lang.NullPointerException
at org.drools.reteoo.AccumulateNode.getFirstMatch(AccumulateNode.java:1050)
at
org.drools.reteoo.AccumulateNode.modifyLeftTuple(AccumulateNode.java:345)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateModifyChildLeftTuple(SingleLeftTupleSinkAdapter.java:259)
at
org.drools.reteoo.AccumulateNode.evaluateResultConstraints(AccumulateNode.java:676)
at
org.drools.reteoo.ReteooWorkingMemory$EvaluateResultConstraints.execute(ReteooWorkingMemory.java:590)
at
org.drools.common.PropagationContextImpl.evaluateActionQueue(PropagationContextImpl.java:350)
at
org.drools.rule.SlidingLengthWindow.assertFact(SlidingLengthWindow.java:119)
at org.drools.rule.BehaviorManager.assertFact(BehaviorManager.java:94)
at org.drools.reteoo.WindowNode.assertObject(WindowNode.java:167)
at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:497)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:382)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:235)
at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:240)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:350)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:311)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:127)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:55)
Is it a bug, or am I doing something completely wrong?
--
View this message in context: http://drools.46999.n3.nabble.com/NullPointerException-using-2-sliding-windows-and-accumulate-functions-tp4024732.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
More information about the rules-users
mailing list