I can not initialize property as need to log the message. The bean comes from outside our
application scope. We do not have control to make them menodatory. And we need to log the
message. You mean there is no solution of this problem? And remember my second rule does
not compare propery but it performs some calculations.
Date: Wed, 13 May 2009 09:01:05 +0200
Subject: Re: [rules-users] NullPointerException with Wrapper objects
From: wolfgang.laun(a)gmail.com
To: rules-users(a)lists.jboss.org
What about setting the field to 0 in the constructor of Salary?
Or using float (not java.lang.Float)?
-W
2009/5/13 Shabbir Dhari <sdhari(a)hotmail.com>
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(a)yahoo.com
Subject: Re: [rules-users] NullPointerException with Wrapper objects
To: rules-users(a)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
Check out the new Windows Live Messenger Looking for a fresh way to share your photos?
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_________________________________________________________________
View photos of singles in your area Click Here
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fdating%2Eninemsn%2Ecom%2E...