[jboss-jira] [JBoss JIRA] (JBRULES-3130) Regression. Rule misfires due to constraint list[0].field1/2 in two rules
Edson Tirelli (Resolved) (JIRA)
jira-events at lists.jboss.org
Wed Jan 4 12:24:10 EST 2012
[ https://issues.jboss.org/browse/JBRULES-3130?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Edson Tirelli resolved JBRULES-3130.
------------------------------------
Fix Version/s: 5.3.2.Final
5.4.0.Beta1
(was: 5.2.1.Final)
Resolution: Done
Previously fixed. Added test case. Thanks for reporting.
> Regression. Rule misfires due to constraint list[0].field1/2 in two rules
> -------------------------------------------------------------------------
>
> Key: JBRULES-3130
> URL: https://issues.jboss.org/browse/JBRULES-3130
> Project: Drools
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 5.2.0.Final
> Reporter: Wolfgang Laun
> Assignee: Edson Tirelli
> Priority: Critical
> Fix For: 5.3.2.Final, 5.4.0.Beta1
>
>
> A pair of constraints suich as list[0].a == null and list[0].b == null in two different rules causes one of the rules not to fire and the other one to fire erroneously (see results at the end).
> Java:
> ------------------------------------------------------------
> public class Three {
> private String a;
> private String b;
> private String c;
> public Three( String a, String b, String c ){
> this.a = a;
> this.b = b;
> this.c = c;
> }
> public String getA(){ return a; }
> public String getB(){ return b; }
> public String getC(){ return c; }
> }
> ---------------------------------------------------------------
> import java.util.*;
> public class ListOfThree {
> private List<Three> list;
> private Class<?> clazz;
> public ListOfThree( Three three, Class<?> clazz ){
> list = new ArrayList<Three>();
> list.add( three );
> this.clazz = clazz;
> }
> public List<Three> getList(){ return list; }
> public Class<?> getClazz(){ return clazz; }
> }
> ----------------------------------------------------------------
> // Insertion of facts
> Three three = new Three( "a", "b", "c" );
> ListOfThree listof3 = new ListOfThree( three, java.lang.Object.class );
> kSession.insert( listof3 );
> three = new Three( "x", null, "z" );
> listof3 = new ListOfThree( three, java.lang.String.class );
> kSession.insert( listof3 );
> three = new Three( null, "q", "r" );
> listof3 = new ListOfThree( three, java.lang.Integer.class );
> kSession.insert( listof3 );
> --------------------------------------------------------------------------
> rule 'rule1'
> // dialect "mvel" // does not matter
> when
> ListOfThree( list[0].a == null, $c: clazz );
> then
> System.out.println( "rule1 " + $c.getSimpleName() );
> end
> rule 'rule2'
> // dialect "mvel" // does not matter
> when
> ListOfThree( list[0].b == null, $c: clazz );
> then
> System.out.println( "rule2 " + $c.getSimpleName() );
> end
> ---------------------------------------------------------------
> Results:
> rule2 Integer
> rule1 Integer
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list