<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=046173009-29012007><FONT face=Arial 
color=#0000ff size=2>You'll probably need to ensure the String object contains a 
valid object reference and not a null.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=046173009-29012007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=046173009-29012007><FONT face=Arial 
color=#0000ff size=2>If the database allows NULL values on a field then the 
String object will be set to a null causing the problem you explain. An 
alternative is to either set the String to an empty String ("") instead of null 
or change your rule to first check whether the String is a null; for example 
<FONT face="Courier New">beanObject.getName() != null &amp;&amp; 
beanObject.getName()=="smurf"</FONT>.</FONT></SPAN></DIV><BR>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>From:</B> rules-users-bounces@lists.jboss.org 
  [mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of 
  </B>Mahantesh<BR><B>Sent:</B> 29 January 2007 08:58<BR><B>To:</B> 
  rules-users@lists.jboss.org<BR><B>Subject:</B> [rules-users] required some 
  input on String comparision in xml rulefile.<BR></FONT><BR></DIV>
  <DIV></DIV><SPAN class=gmail_quote></SPAN>Hi,<BR><BR>I am using Drools 3 JBoss 
  Rule Engine and xml file as a rule file. when i am using integer condition in 
  LHS part of rule file it is working fine. <BR>For example:&nbsp; &lt;eval&gt; 
  beanObject.getNumber &gt;= 60 &lt;/eval&gt; <BR><BR>but when using&nbsp; 
  string condition in LHS part of the rule file, it is able to filter the data 
  when setting and getting the data from the dummy bean, but not able to filter 
  the data when the data is coming from the database its throwing the exceptions 
  like this. <BR><BR>For Example: &lt;eval&gt; 
  beanObject.getName()&lt;/eval&gt;<BR><BR>Exception like 
  this.<BR><BR>org.drools.RuntimeDroolsExcept
  <DIV style="DIRECTION: ltr">ion: java.lang.NullPointerException<BR>&nbsp; 
  &nbsp; &nbsp; &nbsp;at org.drools.rule.EvalCondition.isAllowed (Unknown 
  Source)<BR>&nbsp; &nbsp; &nbsp; &nbsp;at 
  org.drools.reteoo.EvalConditionNode.assertTuple(Unknown Source)<BR>&nbsp; 
  &nbsp; &nbsp; &nbsp;at 
  org.drools.reteoo.TupleSource.propagateAssertTuple(Unknown Source)<BR>&nbsp; 
  &nbsp; &nbsp; &nbsp;at org.drools.reteoo.JoinNode.assertObject (Unknown 
  Source)<BR>&nbsp; &nbsp; &nbsp; &nbsp;at 
  org.drools.reteoo.ObjectSource.propagateAssertObject(Unknown Source)<BR>&nbsp; 
  &nbsp; &nbsp; &nbsp;at org.drools.reteoo.ObjectTypeNode.assertObject(Unknown 
  Source)<BR>&nbsp; &nbsp; &nbsp; &nbsp;at org.drools.reteoo.Rete.assertObject 
  (Unknown Source)<BR>&nbsp; &nbsp; &nbsp; &nbsp;at 
  org.drools.reteoo.ReteooRuleBase.assertObject(Unknown Source)<BR>&nbsp; &nbsp; 
  &nbsp; &nbsp;at org.drools.reteoo.ReteooWorkingMemory.doAssertObject(Unknown 
  Source)<BR>&nbsp; &nbsp; &nbsp; &nbsp;at 
  org.drools.common.AbstractWorkingMemory.assertObject (Unknown 
  Source)<BR>&nbsp; &nbsp; &nbsp; &nbsp;at 
  org.drools.common.AbstractWorkingMemory.assertObject(Unknown Source)<BR>&nbsp; 
  &nbsp; &nbsp; &nbsp;at 
  org.drools.jsr94.rules.StatelessRuleSessionImpl.executeRules(Unknown 
  Source)<BR>&nbsp; &nbsp; &nbsp; &nbsp;at 
  org.drools.jsr94.rules.StatelessRuleSessionImpl.executeRules (Unknown 
  Source)<BR>&nbsp; &nbsp; &nbsp; &nbsp;at 
  rules1.TestRuleForXML.applyRuleTestingProcessVO(TestRuleForXML.java:176)<BR>&nbsp; 
  &nbsp; &nbsp; &nbsp;at 
  rules1.TestRuleForXML.applyForProcessVO(TestRuleForXML.java:55)<BR>size of the 
  ouput list in &nbsp;java file: 0 <BR><BR>&nbsp; &nbsp; &nbsp; &nbsp;at 
  rules1.TestRuleForXML.main(TestRuleForXML.java:47)<BR>Caused by: 
  java.lang.NullPointerException<BR>&nbsp; &nbsp; &nbsp; &nbsp;at 
  rules1.Rule_my_rule_0.eval0(Rule_my_rule_0.java:12)<BR>&nbsp; &nbsp; &nbsp; 
  &nbsp;at rules1.Rule_my_rule_0Eval0Invoker.evaluate 
  (Rule_my_rule_0Eval0Invoker.java:19)<BR><BR>If you do a help regarding how to 
  work with String condition in LHS part, it will be great..<BR><BR>Thanks in 
  Advance,<BR>Mahantesh.<BR></DIV><BR><BR><BR><BR><BR></BLOCKQUOTE></BODY></HTML>