[rules-users] Simple Disjunction Question

David Faulkner david.faulkner at amentra.com
Thu Feb 3 16:30:05 EST 2011


Thomas,

I was curious about this and tried to set up a minimal sample, and as far as I can tell, this is not possible.

Based on my testing, even if $a, $b, and $c ARE present, you cannot do this, because the evaluation short-circuits if $a is found, and therefore $b and $c are never defined.

Even putting null-checks around the do($a) lines won't work, because the error happens before the RHS is evaluated.

David Faulkner
david.faulkner at ametnra.com<mailto:david.faulkner at ametnra.com>
________________________________
From: rules-users-bounces at lists.jboss.org [rules-users-bounces at lists.jboss.org] On Behalf Of thomas.polzin at gmail.com [thomas.polzin at gmail.com]
Sent: Thursday, February 03, 2011 3:55 PM
To: rules-users at lists.jboss.org
Subject: [rules-users] Simple Disjunction Question

Hi there

Assume we have a rule like this:

when

$a : A(a==1)
or
($b : B(b==1) and $c : C(c==1))

then

do($a)
do($b)
do($c)

end


Assuming also, that for some reason I do not want to split this rule into two.
Then, I get a NullPointer exception because either $a or $b and $c are not defined.
Is there a way to catch or check for this.

Thanks so much for any help

Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110203/6948b67c/attachment.html 


More information about the rules-users mailing list