[rules-users] Puzzling behavior for null pointer verification in LHS

Hezi Stern hezis at delegatecom.com
Sun Apr 10 10:45:10 EDT 2011


I am puzzled with the following behavior regarding null pointer validation.

 

I have the flowing rule:

rule "Test"

      when

            $ee: ExecutableEvent($taskId: taskid, Type.SOAR == type)

            $tt: TaskTicket($id: id == $taskId)

      then 

      

            logger.info("Rule:test !!!"+$tt.toString());

            if($tt.getScheduledTime() != null)

                  logger.info("Rule:test schedule is not null");

            

end

 

what I get when I execute the system are the two printouts indicated in the
rule, hence the scheduleTime is not null.

 

Now I wish to move the null verification to the LHS by modifying the rule to
(modification is marked in yellow):

 

rule "Test"

      when

            $ee: ExecutableEvent($taskId: taskid, Type.SOAR == type)

            $tt: TaskTicket($id: id == $taskId, scheduledTime != null)

      then 

      

            logger.info("Rule:test !!!"+$tt.toString());

            if($tt.getScheduledTime() != null)

                  logger.info("Rule:test schedule is not null");

            

end

 

at this point running the system results in no printouts, hence the rule is
not true.

Any suggestion why this occurs and how to resolve this? 

The origin of all of this is to add null pointer verification on fields that
I wish to use us in the LHS (not shown in the above example)

 

Thanks 

Hezi

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110410/2797f113/attachment.html 


More information about the rules-users mailing list