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

Swindells, Thomas TSwindells at nds.com
Mon Mar 29 06:00:45 EDT 2010


Have you tried removing the or and just splitting it into two separate rules?

From: rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Sebastian Furth
Sent: 29 March 2010 09:37
To: Rules Users List
Subject: [rules-users] Combined OR/NOT Rules results in NullPointerException

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

________________________________

**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster at nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************

________________________________
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster at nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes.
To protect the environment please do not print this e-mail unless necessary.

An NDS Group Limited company. www.nds.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100329/bc8d9642/attachment.html 


More information about the rules-users mailing list