<br><br><div class="gmail_quote">2009/5/13 Shabbir Dhari <span dir="ltr">&lt;<a href="mailto:sdhari@hotmail.com">sdhari@hotmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">




<div>
Thanks for all you efforts  :) but what is the difference between calling function from every rule or putting null check.</div></blockquote><div><br>It&#39;s much easier to add.<br><br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div> I give up. I am looking for other rule engines.</div></blockquote><div><br>As they must apparently (due to JavaBeans) be Java-based, I&#39;d be very much surprised if you&#39;ll find what you are looking for.<br><br>
-W<br><br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><br> <br>
<hr>
Date: Wed, 13 May 2009 12:19:08 +0200<div><div></div><div class="h5"><br>Subject: Re: [rules-users] NullPointerException with Wrapper objects<br>From: <a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a><br>
To: <a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br><br>Well, I hope you get paid for all the extra work ;-)<br><br>Define, in your .drl file,<br><br>function float safe( Float v ){<br>
      return v == null ? 0 : v;<br>}<br><br>and wrap all references to the &quot;dangerous&quot; field(s) in your LHS pattern expressions with this call, except, of course, in the rule where you fix and log the field.<br>
<br>-W<br><br><br><br>
<div>2009/5/13 Shabbir Dhari <span dir="ltr">&lt;<a href="mailto:sdhari@hotmail.com" target="_blank">sdhari@hotmail.com</a>&gt;</span><br>
<blockquote style="padding-left: 1ex;">
<div>
<span style="font-size: 10pt; color: rgb(68, 68, 68); line-height: 115%;">Well I cant explain you all the issues and requirements here. Simply we dont have provision to do so. We have to check the null in the rules and log the message plus other evaluation and arithmetic.</span><br>
 <br>
<hr>
Date: Wed, 13 May 2009 10:36:59 +0200
<div>
<div></div>
<div><br>Subject: Re: [rules-users] NullPointerException with Wrapper objects<br>From: <a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a><br>To: <a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<br>But you do control the insertion of your facts. Rather than cluttering rules with conditions dealing with irregular values, preprocess the object. And you should be able to log from there, just as well.<br>-W<br><br>
<div>2009/5/13 Shabbir Dhari <span dir="ltr">&lt;<a href="mailto:sdhari@hotmail.com" target="_blank">sdhari@hotmail.com</a>&gt;</span><br>
<blockquote style="padding-left: 1ex;">
<div>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. <br>
 <br>
<hr>
Date: Wed, 13 May 2009 09:01:05 +0200 
<div><br>Subject: Re: [rules-users] NullPointerException with Wrapper objects<br></div>From: <a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a> 
<div><br>To: <a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br><br>What about setting the field to 0 in the constructor of Salary?<br>Or using float (not java.lang.Float)?<br>
-W<br><br>
<div>2009/5/13 Shabbir Dhari <span dir="ltr">&lt;<a href="mailto:sdhari@hotmail.com" target="_blank">sdhari@hotmail.com</a>&gt;</span><br>
<blockquote style="padding-left: 1ex;">
<div>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?<br>
<br>&gt; Date: Tue, 12 May 2009 23:15:54 -0700<br>&gt; From: <a href="mailto:greg_barton@yahoo.com" target="_blank">greg_barton@yahoo.com</a><br>&gt; Subject: Re: [rules-users] NullPointerException with Wrapper objects 
<div><br>&gt; To: <a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>&gt; <br>&gt; <br></div>
<div>&gt; 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&#39;re doing it will not work.<br>
&gt; <br>&gt; You must put the null check in the same rule, before the potentially null property is used.<br>&gt; <br>&gt; rule &quot;Nett Salary&quot; salience 70<br>&gt; when<br>&gt; Salary ( loanDeduction != null, nett != ( gross – loanDeduction – pf) )<br>
&gt; then<br>&gt; log(&quot;Invalid nett salary amount&quot;);<br>&gt; end<br>&gt; <br><br><br></div>
<hr>
Check out the new Windows Live Messenger <a href="http://windowslive.ninemsn.com.au/article.aspx?id=792335" target="_blank">Looking for a fresh way to share your photos?</a></div><br>_______________________________________________<br>
rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org" target="_blank">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>
<br></blockquote></div><br><br></div>
<hr>
Click Here <a href="http://a.ninemsn.com.au/b.aspx?URL=http://dating.ninemsn.com.au/search/search.aspx?exec%3Dgo%26tp%3Dq%26gc%3D2%26tr%3D1%26lage%3D18%26uage%3D55%26cl%3D14%26sl%3D0%26dist%3D50%26po%3D1%26do%3D2%26trackingid%3D1046138%26r2s%3D1&amp;_t=773166090&amp;_r=Hotmail_Endtext&amp;_m=EXT" target="_blank">View photos of singles in your area</a></div>
<br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org" target="_blank">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>
<br></blockquote></div><br><br></div></div>
<hr>
Find out how with Windows Live! <a href="http://windowslive.ninemsn.com.au/" target="_blank">Want to stay on top of your life online?</a></div><br>_______________________________________________<br>rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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>
<br></blockquote></div><br><br><hr>Find out how with Windows Live! <a href="http://windowslive.ninemsn.com.au/" target="_blank">Want to stay on top of your life online?</a></div></div></div>
<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>
<br></blockquote></div><br>