[rules-users] Combined OR/NOT Rules results in NullPointerException

Sebastian Furth sebastian.furth at googlemail.com
Mon Mar 29 04:37:25 EDT 2010


Hello,

i've already mailed last week with the same problem and with your help I was
able to locate the source of the following NullPointerException which
happens if we try to insert the Fact "knocking" (@see Source Code of the
Java Class here: http://www.pastie.org/private/juv7hh7rxahpluo5agu3q) :

*java.lang.NullPointerException
    at org.drools.reteoo.LeftTuple.get(LeftTuple.java:265)
    at org.drools.reteoo.LeftTuple.get(LeftTuple.java:300)
    at
org.drools.rule.VariableRestriction$ObjectVariableContextEntry.updateFromTuple(VariableRestriction.java:320)
    at
org.drools.common.SingleBetaConstraints.updateFromTuple(SingleBetaConstraints.java:119)
    at org.drools.reteoo.NotNode.assertLeftTuple(NotNode.java:98)
    at
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:117)
    at
org.drools.reteoo.SingleLeftTupleSinkAdapter.propagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:34)
    at org.drools.reteoo.NotNode.assertLeftTuple(NotNode.java:123)
    at
org.drools.reteoo.CompositeLeftTupleSinkAdapter.doPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:145)
    at
org.drools.reteoo.CompositeLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(CompositeLeftTupleSinkAdapter.java:57)
    at
org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:142)
    at
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:42)
    at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:147)
    at
org.drools.reteoo.CompositeObjectSinkAdapter.doPropagateAssertObject(CompositeObjectSinkAdapter.java:360)
    at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:344)
    at
org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:185)
    at
org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:146)
    at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1046)
    at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1001)
    at
org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:788)
    at
org.drools.impl.StatefulKnowledgeSessionImpl.insert(StatefulKnowledgeSessionImpl.java:216)
    at de.d3web.we.drools.DroolsAction.addFacts(DroolsAction.java:334)
*

The source of the problem is the following rule:

*rule "R50"
  when
    $value1 : Value(value == "knocking")
    not Input(name == "Engine noises" && values contains $value1)
    or
    $value2 : Value(value == "ringing")
    not Input(name == "Engine noises" && values contains $value2)
    $solution : SolutionInput(name == "Bad ignition timing")
  then
    $solution.setValue(N3);
end
*

Could you please tell me how I have to formulate the rule to avoid the
NullPointerException while inserting the fact?

Thank you in advance for your help.

Best regards

Sebastian Furth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100329/6fb16a94/attachment.html 


More information about the rules-users mailing list