[rules-users] evaluation of null not consistent

LJ in NJ ljlevin at criticalarchitectures.com
Fri Apr 16 15:26:42 EDT 2010


Hi;

I am trying to debug a situation in which a rule fires when it should not.
The rule is:

rule "DTR2_AOU_Mapping"
    when
    when
        instance_0_Contact : Contact($var_0_guid : guid != null ) 
        instance_1_Track : Track($var_1_aou : aouAsFloat != null &&
$var_3_platform_ptr : platform != null ) 
        eval($var_3_platform_ptr.getGuid() == $var_0_guid )
    then
              :
              :
The problem is the 2nd condition and the criteria "$var_1_aou : aouAsFloat
!= null ". When fired we get a Null Ptr Exception. When I examened the log
file in the Audit view, I see that the rule has fired even tho it clearly
states that $var_1_aou = null:

	<org.drools.audit.event.ActivationLogEvent>
		<type>4</type>
		<activationId>DTR2_AOU_Mapping [3, 1]</activationId>
		<rule>DTR2_AOU_Mapping</rule>
		<declarations>
                              
$var_3_platform_ptr=com.callc.das.kb.ASW.Contact at 5b21ae2(3);
                              
instance_1_Track=com.callc.das.kb.ASW.Track at 1e071f47(3); 
                              
instance_0_Contact=com.callc.das.kb.ASW.Contact at 5b21ae2(1); 
                               $var_1_aou=null; 
                               $var_0_guid=2139982358(1)
                       </declarations>
	</org.drools.audit.event.ActivationLogEvent>

What makes matters worse is that the EXACT SAME RULE when running in a
different application will behave as expected. What I mean by this is that
we have  embedded the Drools rule engine in two different Java applications,
both of which set-up and use the rule engine with the exact same constructs
and sequence of commands (e.g., use of a StatefulKnowledgeSession). I then
inserted the same information into both. One runs fine but the other
generates the log file shown above and throws :

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)
                                      :
                                      :

Any suggestions regarding what is going on here would be most appreciated as
I am 100% stumped by this. 
Thanks
       Larry
-- 
View this message in context: http://n3.nabble.com/evaluation-of-null-not-consistent-tp724910p724910.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list