Hi,<br><br>I have the following rules,<br><br>global java.util.Set accountNumbers;<br><br>rule "rule 1"<br>when<br> $d : Document()<br> $c : CreditTransferTransactionInformation (dbtrAcct == null || dbtrAcct.id == null || dbtrAcct.id.othr == null || <a href="http://dbtrAcct.id.othr.id">dbtrAcct.id.othr.id</a> == null) from $d.cstmrCdtTrfInitn.cdtTrfTxInf<br>
$i : InternalInfo() from $c.internalInfo<br>then<br> $i.setStatus(PaymentStatus.INVALID);<br> $i.setErrorCode("PR002");<br> $i.setAdditionalInfo("Account number is null");<br>end<br><br>rule "rule 2"<br>
when<br> $d : Document()<br> $c : CreditTransferTransactionInformation(internalInfo.status != PaymentStatus.INVALID && <a href="http://dbtrAcct.id.othr.id">dbtrAcct.id.othr.id</a> not memberOf accountNumbers) from $d.cstmrCdtTrfInitn.cdtTrfTxInf<br>
$i : InternalInfo() from $c.internalInfo<br>then<br> $i.setStatus(PaymentStatus.INVALID);<br> $i.setErrorCode("PR002");<br> $i.setAdditionalInfo("Account number not available in the routing table");<br>
end<br><br>My assumption is rule 1 and rule 2 will be executed in the order they appear. Rule 1 checks all the nested attributes are not null and set the status as invalid if any of them is null. Rule 2 uses the and operator and checks the nested attribute is in the collection defined by the global, only if the object is valid. I assume the LHS of rule 2 will be short circuited if the object is invalid. However, if any of the nested property is null I get the following exception from MVEL.<br>
<br>Caused by: [Error: unable to access property (null parent): id]<br>[Near : {... Unknown ....}]<br> ^<br>[Line: 1, Column: 0]<br> at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:861)<br>
<br>Regards<br>Meeraj<br>