]
Edson Tirelli closed JBRULES-837.
---------------------------------
Fix Version/s: 4.0.0.MR2
(was: 4.0.0.MR3)
Resolution: Done
Collect keyword matches two conflicting rules
---------------------------------------------
Key: JBRULES-837
URL:
http://jira.jboss.com/jira/browse/JBRULES-837
Project: JBoss Rules
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 3.1-m1
Environment: java 1.5
Reporter: Viktor Nordling
Assigned To: Edson Tirelli
Fix For: 4.0.0.MR2
If you have two rules:
rule "A"
when
$a : ArrayList( size:size == 2 ) from collect (Car())
then
System.out.println("A: size = " + size);
end
rule "B"
when
$b : ArrayList( size:size == 3 ) from collect (Car())
then
System.out.println("B: size = " + size);
end
And you put two Cars in working memory, both A and B will be fired. Since there are two
cars in working memory, only rule A should be fired.
If you change the order of the rules, or make rule A match size == 3 and rule B match
size == 2, no rules will be fired instead.
The only workaround found is to add some criteria for the Car, in ONE of the rules. If
rule A for example is:
rule "A"
when
$a : ArrayList( size:size == 2 ) from collect (Car(color == "RED"))
then
System.out.println("A: size = " + size);
end
Then only rule A will be fired. If the same criteria is also added in rule B, both rules
will be fired again.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: