[rules-users] NullPointerException for Integer null

Edson Tirelli tirelli at post.com
Wed Apr 29 08:57:56 EDT 2009


    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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090429/a61ba1a3/attachment.html 


More information about the rules-users mailing list