I am no expert on drools; however, you might want to retract loanDeduction from the Working Memory if it is null.  Your first rule determines that it is null and then you set the value (ld = 0f); however, you should be using an insert to put this into working memory.  The other alternative is to retract the loan Deduction  from working memory and add a logic check in the Nett Salary rule to see if loan Dedcution is null.<br>
<br>I am working on some Drools stuff today if you need some more help on this.<br><br>Shannon<br><br><br><div class="gmail_quote">On Wed, May 13, 2009 at 1:14 AM, dhai <span dir="ltr">&lt;<a href="mailto:sdhari@hotmail.com">sdhari@hotmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
I am facing problems which many have encountered in the past. I searched<br>
forums but could not get precise answer. The problem is with null values in<br>
Wrapper objects. See the following code:<br>
<br>
rule &quot;Null Check &quot; salience 100<br>
        when<br>
                Salary ( ld : loanDeduction==null || &lt; 0f ) // loanDeduction<br>
is java.lang.Float<br>
        then<br>
                log(&quot;Load return is null&quot;); //Global function<br>
                ld = 0f;<br>
end<br>
<br>
rule &quot;Nett Salary&quot; salience 70<br>
        when<br>
                Salary ( nett != ( gross – loanDeduction – pf) )<br>
        then<br>
                log(&quot;Invalid nett salary amount&quot;);<br>
end<br>
<br>
You may have idea what I am trying to do. But I get NullPointerException in<br>
“Nett Salary” rule when I fire the rules having fact with null in the<br>
loanDeduction attribute. I believe my “Null Check” exception should execute<br>
first and it does when I put negative value in loadDeduction. What is<br>
solution in such a case?<br>
--<br>
View this message in context: <a href="http://www.nabble.com/NullPointerException-with-Wrapper-objects-tp23515500p23515500.html" target="_blank">http://www.nabble.com/NullPointerException-with-Wrapper-objects-tp23515500p23515500.html</a><br>

Sent from the drools - user mailing list archive at Nabble.com.<br>
<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br>