[rules-users] NullPointerException for Integer null

techy techluver007 at gmail.com
Fri May 1 15:13:07 EDT 2009


You are right Edson. 
I also have another rule with less salience value that does < comparison. my
attention was completely on first rule which does null check and thinking
that was causing the issue :(. Good find and thanks again for the help.



Edson Tirelli-3 wrote:
> 
>     Techy,
> 
>     I don't know how you got this exception, but I tried to reproduce it
> here with 4.0.x branch and was not able to. Also, it is very strange that
> your exception stack has this:
> 
> org.drools.base.evaluators.IntegerFactory$IntegerLessEvaluator.evaluate(IntegerFactory.java:241)
> 
>     Suggesting that you are using a "<" evaluator and not an "=="
> evaluator
> as your sample. Also, by the stack trace, it seems you are using a bound
> variable, not an explicit "null" constant. So definitively, it is not the
> rule you are showing in your e-mail bellow.
> 
>     If you can get an isolated test case that can be reproduced, please
> open
> a JIRA and attach the test case and I will investigate.
> 
>     []s
>     Edson
> 
> 2009/4/28 techy <techluver007 at gmail.com>
> 
>>
>> Hello,
>> For following rule, NullPointerException  is thrown for null id in 4.x.
>> is
>> this expected? Please clarify.
>>
>> Foo{
>> Integer id;
>> }
>> Rule "null check"
>> foo : Foo(id==null)
>> then
>> end
>>
>> stack trace:
>> java.lang.NullPointerException
>>        at
>>
>> org.drools.base.extractors.BaseObjectClassFieldExtractor.getIntValue(BaseObjectClassFieldExtractor.java:95)
>>        at
>>
>> org.drools.base.ClassFieldExtractor.getIntValue(ClassFieldExtractor.java:197)
>>        at
>>
>> org.drools.base.evaluators.IntegerFactory$IntegerLessEvaluator.evaluate(IntegerFactory.java:241)
>>        at
>> org.drools.rule.VariableRestriction.isAllowed(VariableRestriction.java:73)
>>        at
>> org.drools.rule.VariableConstraint.isAllowed(VariableConstraint.java:67)
>>        at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
>>        at
>>
>> org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
>>        at
>> org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:162)
>>        at org.drools.reteoo.Rete.assertObject(Rete.java:175)
>>        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:911)
>>        at
>>
>> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:883)
>>        at
>>
>> org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:684)
>>        at
>>
>> org.drools.reteoo.ReteooStatelessSession.execute(ReteooStatelessSession.java:160)
>>
>> --
>> View this message in context:
>> http://www.nabble.com/NullPointerException-for-Integer-null-tp23286041p23286041.html
>> Sent from the drools - user mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
> 
> 
> 
> -- 
>  Edson Tirelli
>  JBoss Drools Core Development
>  JBoss, a division of Red Hat @ www.jboss.com
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 

-- 
View this message in context: http://www.nabble.com/NullPointerException-for-Integer-null-tp23286041p23338264.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list