That's almost all the details in the mail subject; When I am running this rule in drools 5.1.0:
package com.sample
import com.sample.Msg;
import java.util.Date;
rule "Hello World"
when
m1:Msg()
m:Msg(dbl > lo || m1.in == in)
then
end
The java bean named 'Msg' definition:
package com.sample;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
public class Msg {
private Long lo = 5l;
private double dbl = 5.5;
private Date date = new Date();
private int in = 4;
private boolean bool;
private Set<String> set = new HashSet<String>();
... // getter and setters ignored
then it throws exception :
java.lang.NullPointerException
at org.drools.reteoo.LeftTuple.get(LeftTuple.java:399)
at org.drools.reteoo.LeftTuple.get(LeftTuple.java:434)
at org.drools.rule.VariableRestriction$DoubleVariableContextEntry.updateFromTuple(VariableRestriction.java:563)
at org.drools.rule.AbstractCompositeConstraint$MultiFieldConstraintContextEntry.updateFromTuple(AbstractCompositeConstraint.java:306)
at org.drools.common.SingleBetaConstraints.updateFromTuple(SingleBetaConstraints.java:123)
at org.drools.reteoo.JoinNode.assertLeftTuple(JoinNode.java:77)
at org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:189)
at org.drools.reteoo.SingleLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:138)
at org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:148)
at org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:450)
at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:378)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:190)
at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:145)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1174)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1123)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:917)
at org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:251)
at com.sample.DroolsTest.main(DroolsTest.java:43)
I think I am doing nothing wrong with the code, is this a bug or something? Or just comparing properties in the same bean class is illegal?