You'll probably need to ensure the String object contains a
valid object reference and not a null.
If the database allows NULL values on a field then the
String object will be set to a null causing the problem you explain. An
alternative is to either set the String to an empty String ("") instead of null
or change your rule to first check whether the String is a null; for example
beanObject.getName() != null &&
beanObject.getName()=="smurf".
Hi,
I am using Drools 3 JBoss
Rule Engine and xml file as a rule file. when i am using integer condition in
LHS part of rule file it is working fine.
For example: <eval>
beanObject.getNumber >= 60 </eval>
but when using
string condition in LHS part of the rule file, it is able to filter the data
when setting and getting the data from the dummy bean, but not able to filter
the data when the data is coming from the database its throwing the exceptions
like this.
For Example: <eval>
beanObject.getName()</eval>
Exception like
this.
org.drools.RuntimeDroolsExcept
ion: java.lang.NullPointerException
at org.drools.rule.EvalCondition.isAllowed (Unknown
Source)
at
org.drools.reteoo.EvalConditionNode.assertTuple(Unknown Source)
at
org.drools.reteoo.TupleSource.propagateAssertTuple(Unknown Source)
at org.drools.reteoo.JoinNode.assertObject (Unknown
Source)
at
org.drools.reteoo.ObjectSource.propagateAssertObject(Unknown Source)
at org.drools.reteoo.ObjectTypeNode.assertObject(Unknown
Source)
at org.drools.reteoo.Rete.assertObject
(Unknown Source)
at
org.drools.reteoo.ReteooRuleBase.assertObject(Unknown Source)
at org.drools.reteoo.ReteooWorkingMemory.doAssertObject(Unknown
Source)
at
org.drools.common.AbstractWorkingMemory.assertObject (Unknown
Source)
at
org.drools.common.AbstractWorkingMemory.assertObject(Unknown Source)
at
org.drools.jsr94.rules.StatelessRuleSessionImpl.executeRules(Unknown
Source)
at
org.drools.jsr94.rules.StatelessRuleSessionImpl.executeRules (Unknown
Source)
at
rules1.TestRuleForXML.applyRuleTestingProcessVO(TestRuleForXML.java:176)
at
rules1.TestRuleForXML.applyForProcessVO(TestRuleForXML.java:55)
size of the
ouput list in java file: 0
at
rules1.TestRuleForXML.main(TestRuleForXML.java:47)
Caused by:
java.lang.NullPointerException
at
rules1.Rule_my_rule_0.eval0(Rule_my_rule_0.java:12)
at rules1.Rule_my_rule_0Eval0Invoker.evaluate
(Rule_my_rule_0Eval0Invoker.java:19)
If you do a help regarding how to
work with String condition in LHS part, it will be great..
Thanks in
Advance,
Mahantesh.