Looks like one of the $ldapResponseMap : Map() entries for keys "zimbraDomainName" or "zimbraDomainType" is not there.
-W
Hello,I am facing a problem with the following code with Drools 5.0.1:
I insert multiple objects as facts into my stateful session here:
===============================================================StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();/** mapTypes here is an array of MapType objects **/for(int i=0;i<mapTypes.length;i++) {System.out.println("Inserting the fact type: " + mapTypes[i]);ksession.insert(mapTypes[i]);}ksession.insert(ldapLookupKey);ksession.insert(ldapResponseMap);ksession.fireAllRules();ksession.dispose();===============================================================
And here is my drools file:
===============================================================
rule "LocalRecipient"when$myMapType : MapType( name == "LocalRecipient" )$lookupKey : String()$ldapResponseMap : Map()eval( ((($ldapResponseMap.get("zimbraMailDeliveryAddress").equals($lookupKey)) ||($ldapResponseMap.get("zimbraMailAlias").equals($lookupKey)) ||($ldapResponseMap.get("zimbraMailCatchAllAddress").equals($lookupKey))) &&($ldapResponseMap.get("zimbraMailStatus").equals("enabled"))) )thenSystem.out.println("This LocalRecipient rule should work");$myMapType.setQueryFilterCheck(true);end
rule "VirtualMailboxDomain"when$myMapType : MapType( name == "VirtualMailboxDomain" )$lookupKey : String()$ldapResponseMap : Map()eval( (($ldapResponseMap.get("zimbraDomainName").equals($lookupKey)) &&($ldapResponseMap.get("zimbraDomainType").equals("local")) &&($ldapResponseMap.get("zimbraMailStatus").equals("enabled"))) )thenSystem.out.println("This VirtualMailboxDomain rule should work");$myMapType.setQueryFilterCheck(true);End
===============================================================
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.
As soon I put the rule002 above, I started getting a NullPointerException with the following lines in the stack trace.
===============================================================Caused by: java.lang.NullPointerExceptionat com.aol.postfixcache.Rule_LocalRecipient_Rule_0.eval0(Rule_LocalRecipient_Rule_0.java:8)at com.aol.postfixcache.Rule_LocalRecipient_Rule_0Eval0Invoker.evaluate(Rule_LocalRecipient_Rule_0Eval0Invoker.java:23)at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:117)===============================================================
I tried different combinations along with an extensive search to see why I am getting this, but couldn't crack it. Appreciate your help.
Regards,Murty.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users