[rules-users] Interesting null pointer exception when inserting a fact.
Jason Partyka
Jason.Partyka at hightowerinc.com
Sat Mar 8 10:56:43 EST 2008
Hi Edson,
I'll do my best. The rule uses a DSL, so I will post the specific rule and then the corresponding DSL file. I do believe it's happening inside the eval.
Rule:
rule "awe"
dialect "mvel"
ruleflow-group 'Validation'
when
A AReallyWonderfulAndCrappyTest entry has results where
BasicMountFridayTest mountType IsEqualTo "T"
then
set BasicBlindFridayTest_JP rightwidht to 44
end
DSL:
[condition][]A {TemplateName} entry has results where=$daObj : {TemplateName}()
[condition][]{field} IsEqualTo {value}=eval ( {field} == {value} )
[condition][]{field} LessThan {value}=eval ( {field} < {value} )
[condition][]{field} GreaterThan {value}=eval ( {field} > {value} )
[condition][]{field} LessThanOrrEqualTo {value}=eval ( {field} <= {value} )
[condition][]{field} GreaterThanOrrEqualTo {value}=eval ( {field} >= {value} )
[condition][]{field} NotEqualTo {value}=eval ( {field} != {value} )
[condition][]A {TemplateName} entry is valid=$daObj : {TemplateName}()
[consequence][]set {Field} {Member} to {Value}=$daObj.get{Field}().set{Member}({Value});
[consequence][]Log {value}=LOG.info({value});
[consequence][]set {GlobalVar} {Member} to {Value}={GlobalVar}.set{Member}({Value})
[consequence][]set {Field} {Member1} to global {GlobalVar} {GlobalMember}=$daObj.get{Field}().set{Member}({GlobalVar}.get{GlobalMember}())
[*][]set global {GlobalVar} {Member1} to global {GlobalVar} {Member2}={GlobalVar}.set{Member1}({GlobalVar}.get{Member2}())
[consequence][]show {field} {Member1}=$daObj.get{field}().set{Member1}Visible(true);
[consequence][]hide {field} {Member1}=$daObj.get{field}().set{Member1}Visible(false);
[consequence][]show table {field}=$daObj.set{field}Visible(true);
[consequence][]hide table {field}=$daObj.set{field}Visible(false);
________________________________
From: rules-users-bounces at lists.jboss.org [rules-users-bounces at lists.jboss.org] On Behalf Of Edson Tirelli [tirelli at post.com]
Sent: Saturday, March 08, 2008 7:14 AM
To: Rules Users List
Subject: Re: [rules-users] Interesting null pointer exception when inserting a fact.
Jason,
Can you please isolate and show us the rule that is creating the problem? It is happening either in a eval() statement or in a nested property access.
[]s
Edson
2008/3/7, Jason Partyka <Jason.Partyka at hightowerinc.com<mailto:Jason.Partyka at hightowerinc.com>>:
Hi,
This is in relation to drools 4.0.4
I have an interesting problem. I am getting a null pointer exception when I am inserting a fact into a StatefulSession object. What is odd about this NPE is that, as far as I can tell (and I have inserted a breakpoint right before I insert the fact) that all the properties in the object are initialized, and there are no rules accessing any thing that could be null.
So here's my exception trace (just first few lines to get context):
Exception in thread "AWT-EventQueue-0" org.drools.RuntimeDroolsException: java.lang.NullPointerException
at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:76)
at org.drools.reteoo.EvalConditionNode.assertTuple(EvalConditionNode.java:145)
at org.drools.reteoo.SingleTupleSinkAdapter.createAndPropagateAssertTuple(SingleTupleSinkAdapter.java:55)
at org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:116)
at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:22)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:153)
at org.drools.reteoo.Rete.assertObject(Rete.java:177)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:886)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:858)
at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:659)
at com.hightower.drools.executablerules.Rules.setTemplate(Rules.java:112)
....
Caused by: java.lang.NullPointerException
at org.drools.base.mvel.MVELEvalExpression.evaluate(MVELEvalExpression.java:39)
at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:72)
... 39 more
(that setTemplate method is not a drools template)
Any ideas?
Thanks,
Jason
_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org<mailto:rules-users at lists.jboss.org>
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @ www.jboss.com<http://www.jboss.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080308/80fae226/attachment.html
More information about the rules-users
mailing list