<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif; ">
<div>Hello,</div>
<div>I am facing a problem with the following code with Drools 5.0.1:</div>
<div><br>
</div>
<div>I insert multiple objects as facts into my stateful session here:</div>
<div><br>
</div>
<div>===============================================================</div>
<div>
<div>StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div>
<div>&nbsp;/**<span style="font-weight: bold"> &nbsp;mapTypes here is an array of MapType objects
</span>**/&nbsp; &nbsp;&nbsp;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; for(int i=0;i&lt;mapTypes.length;i&#43;&#43;) {</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Inserting the fact type: &quot; &#43; mapTypes[i]);</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ksession.insert(mapTypes[i]);</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;ksession.insert(ldapLookupKey);</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; ksession.insert(ldapResponseMap);</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; ksession.fireAllRules();</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; ksession.dispose();</div>
</div>
<div>
<div>===============================================================</div>
<div></div>
</div>
<div><br>
</div>
<div>And here is my drools file:</div>
<div><br>
</div>
<div>
<div>===============================================================</div>
<div><br>
</div>
<div>
<div>rule &quot;LocalRecipient&quot;</div>
<div>&nbsp; &nbsp; when</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; $myMapType : MapType( name &nbsp;== &nbsp;&quot;LocalRecipient&quot; )</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; $lookupKey : String()</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; $ldapResponseMap : Map()</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; eval( ((($ldapResponseMap.get(&quot;zimbraMailDeliveryAddress&quot;).equals($lookupKey)) ||</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ($ldapResponseMap.get(&quot;zimbraMailAlias&quot;).equals($lookupKey)) ||</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ($ldapResponseMap.get(&quot;zimbraMailCatchAllAddress&quot;).equals($lookupKey))) &amp;&amp;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ($ldapResponseMap.get(&quot;zimbraMailStatus&quot;).equals(&quot;enabled&quot;))) )</div>
<div>&nbsp; &nbsp; then</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;This LocalRecipient rule should work&quot;);</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; $myMapType.setQueryFilterCheck(true);</div>
<div>end</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>rule &quot;VirtualMailboxDomain&quot;</div>
<div>&nbsp; &nbsp; when</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;$myMapType : MapType( name &nbsp;== &nbsp;&quot;VirtualMailboxDomain&quot; )</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; $lookupKey : String()</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; $ldapResponseMap : Map()</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; eval( (($ldapResponseMap.get(&quot;zimbraDomainName&quot;).equals($lookupKey)) &amp;&amp;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;($ldapResponseMap.get(&quot;zimbraDomainType&quot;).equals(&quot;local&quot;)) &amp;&amp;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;($ldapResponseMap.get(&quot;zimbraMailStatus&quot;).equals(&quot;enabled&quot;))) )</div>
<div>&nbsp; &nbsp; then</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;This VirtualMailboxDomain rule should work&quot;);</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; $myMapType.setQueryFilterCheck(true);</div>
<div>End</div>
</div>
<div><br>
</div>
<div>
<div>===============================================================</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Now the problem I am facing is, as long as I defined only rule001 above, it works like a charm and the MapType.QueryFilterCheck flag gets set to TRUE. &nbsp;</div>
<div><br>
</div>
<div>As soon I put the rule002 above, I started getting a NullPointerException with the following lines in the stack trace.</div>
<div><br>
</div>
<div>
<div>
<div>===============================================================</div>
</div>
</div>
<div>Caused by: java.lang.NullPointerException</div>
<div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at com.aol.postfixcache.Rule_LocalRecipient_Rule_0.eval0(Rule_LocalRecipient_Rule_0.java:8)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at com.aol.postfixcache.Rule_LocalRecipient_Rule_0Eval0Invoker.evaluate(Rule_LocalRecipient_Rule_0Eval0Invoker.java:23)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:117)</div>
</div>
<div>
<div>
<div>===============================================================</div>
</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>I tried different combinations along with an extensive search to see why I am getting this, but couldn't crack it. &nbsp;Appreciate your help.</div>
<div><br>
</div>
<div>Regards,</div>
<div>Murty.</div>
<div><br>
</div>
<div><br>
</div>
<div></div>
</div>
</body>
</html>