[rules-users] NullPointerException with Wrapper objects

Shabbir Dhari sdhari at hotmail.com
Wed May 13 02:26:32 EDT 2009




I know this
work around. But I have more than 50 rules using that attribute and it looks
very ugly to put null on every rule and its not single attribute. There are
more than 30 attributes in the bean and using them in LHS. Any other sophisticated
way?


> Date: Tue, 12 May 2009 23:15:54 -0700
> From: greg_barton at yahoo.com
> Subject: Re: [rules-users] NullPointerException with Wrapper objects
> To: rules-users at lists.jboss.org
> 
> 
> All conditions of all applicable rules are evaluated when you insert an object into working memory.  This decides which rule actions can go on the agenda.  Only when a rule action is on the agenda is the salience used to determine the order of action firing.  So doing the null check in the way you're doing it will not work.
> 
> You must put the null check in the same rule, before the potentially null property is used.
> 
> rule "Nett Salary" salience 70
>   when
>     Salary ( loanDeduction != null, nett != ( gross – loanDeduction – pf) )
>   then
>     log("Invalid nett salary amount");
> end
> 


_________________________________________________________________
Looking for a fresh way to share your photos? Check out the new Windows Live Messenger
http://windowslive.ninemsn.com.au/article.aspx?id=792335
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090513/dc789469/attachment.html 


More information about the rules-users mailing list