[rules-users] Drools upgrade from 3 to 5 - '||' OR syntax

Nars narayanan.anantharaman at citi.com
Wed Mar 24 11:32:05 EDT 2010


We are migrating couple hundred rules from Drools 3 to 5. 

We have rules like below.

rule "Test rule"
	salience 100000
	when
		core : BWCore(systemId == "1" ) ||			
			BWCore(systemId == "2" ) ||
			BWCore(systemId == "3") 
	then
		System.out.println( "bwid: " + core.getBWIntId());
end

This rule works fine in 3, but in 4 and 5 it throws below exception when we
insert a BWCore object with systemId 2. The same works fine if the object
inserted has systemId as 1.

org.drools.runtime.rule.ConsequenceException: java.lang.NullPointerException

	at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:23)
	at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:943)
	at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:885)
	at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1086)
	at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:660)
	at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:627)
	at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:183)
	at com.sample.BWTest.main(BWTest.java:32)
Caused by: java.lang.NullPointerException
	at org.drools.reteoo.LeftTuple.get(LeftTuple.java:300)
	at
com.sample.Rule_Make_BossBWs_FABWs_and_TMCBWs_retail_bws_0ConsequenceInvoker.evaluate(Rule_Make_BossBWs_FABWs_and_TMCBWs_retail_bws_0ConsequenceInvoker.java:15)
	at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:934)
	... 6 more

Is this kind of || syntax no longer supported in 4 and 5?

Thanks
-- 
View this message in context: http://n3.nabble.com/Drools-upgrade-from-3-to-5-OR-syntax-tp471205p471205.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list