Firstly evals have to evaluate true or false - what you have here appears to return a string - presumably you are actually comparing this to some value?
One, not particularly elegant or efficient method is to do the check within your eval, eg: eval(ClaimsHistoryHelper.getClaimDrug(drugRefNo) == null ? false : drugName == (ClaimsHistoryHelper.getClaimDrug(drugRefNo)).getDrugName()) If your ClaimsHistoryHelper is doing a time consuming operation (eg going to a db etc), you can probably make a very quick and simple efficiency saving by having it cache the last result it searched for/returned (or depending on how many drugRefNo you are looking up a more complete caching solution). Thomas > -----Original Message----- > From: [email protected] [mailto:rules-users- > [email protected]] On Behalf Of sdinoo > Sent: 07 June 2011 06:22 > To: [email protected] > Subject: [rules-users] Exception Handling in the rule > > Hi, > > In my when clause I have an eval statement like this > > eval((ClaimsHistoryHelper.getClaimDrug(drugRefNo)).getDrugName()) > > For some reason, there is no DrugRecord for the given drugRefNo and hence > I get javaNullPointer exceptions I do want to rule to continue evaluation and > not stop with the error and hence I dont want to handle exception at > fireAllRules catch block > > How can I handle the exception in the DRL ? > > > > > > -- > View this message in context: http://drools.46999.n3.nabble.com/Exception- > Handling-in-the-rule-tp3033223p3033223.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users ************************************************************************************** This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the [email protected] and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary. NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00 ************************************************************************************** _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
