Wolfgang Laun | 23 Jun 2012 12:23
Picon

[rules-dev] Evil bug in 5.4.0: wrong fact selected by simple constraint due to window:length()

It should be pretty obvious that the rule should not fire after the
insertion of a single fact.

declare MyEvent
 <at> role(event)
end

rule FaultsCoincide
when
    f1 : MyEvent( key == "type1" ) over window:length( 1 )
    f2 : MyEvent( key == "type2" ) over window:length( 1 )
then
    System.out.println( ">>> f1=" + f1 + " f2=" + f2 );
    if( f2.getKey().equals( "type1" ) ) System.out.println( "*** BUG ***" );
end

insert MyEvent<type1,ALARM>
>>> f1=MyEvent<type1,ALARM> f2=MyEvent<type1,ALARM>
*** BUG ***
insert MyEvent<type2,ALARM>
>>> f1=MyEvent<type2,ALARM> f2=MyEvent<type2,ALARM>
>>> f1=MyEvent<type2,ALARM> f2=MyEvent<type1,ALARM>
*** BUG ***
_______________________________________________
rules-dev mailing list
rules-dev <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev

Edson Tirelli | 23 Jun 2012 20:53
Picon
Gravatar

Re: [rules-dev] Evil bug in 5.4.0: wrong fact selected by simple constraint due to window:length()


   Thanks Wolfgang, I will fix it asap. Traveling during the next week, but should not take long.

   Edson

On Sat, Jun 23, 2012 at 6:23 AM, Wolfgang Laun <wolfgang.laun <at> gmail.com> wrote:
It should be pretty obvious that the rule should not fire after the
insertion of a single fact.

declare MyEvent
<at> role(event)
end

rule FaultsCoincide
when
   f1 : MyEvent( key == "type1" ) over window:length( 1 )
   f2 : MyEvent( key == "type2" ) over window:length( 1 )
then
   System.out.println( ">>> f1=" + f1 + " f2=" + f2 );
   if( f2.getKey().equals( "type1" ) ) System.out.println( "*** BUG ***" );
end

insert MyEvent<type1,ALARM>
>>> f1=MyEvent<type1,ALARM> f2=MyEvent<type1,ALARM>
*** BUG ***
insert MyEvent<type2,ALARM>
>>> f1=MyEvent<type2,ALARM> f2=MyEvent<type2,ALARM>
>>> f1=MyEvent<type2,ALARM> f2=MyEvent<type1,ALARM>
*** BUG ***
_______________________________________________
rules-dev mailing list
rules-dev <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev



--
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat <at> www.jboss.com
_______________________________________________
rules-dev mailing list
rules-dev <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev
Wolfgang Laun | 24 Jun 2012 07:56
Picon

Re: [rules-dev] Evil bug in 5.4.0: wrong fact selected by simple constraint due to window:length()

Here's the code for reproducing.

If there were a place in some file where I could add this by simply
editing a file I'd do it. (I know that it is possible - I've done it
once or twice on some doc XML.)

Cheers
Wolfgang

On 23/06/2012, Edson Tirelli <ed.tirelli <at> gmail.com> wrote:
>    Thanks Wolfgang, I will fix it asap. Traveling during the next week, but
> should not take long.
>
>    Edson
>
> On Sat, Jun 23, 2012 at 6:23 AM, Wolfgang Laun
> <wolfgang.laun <at> gmail.com>wrote:
>
>> It should be pretty obvious that the rule should not fire after the
>> insertion of a single fact.
>>
>> declare MyEvent
>>  <at> role(event)
>> end
>>
>> rule FaultsCoincide
>> when
>>    f1 : MyEvent( key == "type1" ) over window:length( 1 )
>>    f2 : MyEvent( key == "type2" ) over window:length( 1 )
>> then
>>    System.out.println( ">>> f1=" + f1 + " f2=" + f2 );
>>    if( f2.getKey().equals( "type1" ) ) System.out.println( "*** BUG ***"
>> );
>> end
>>
>> insert MyEvent<type1,ALARM>
>> >>> f1=MyEvent<type1,ALARM> f2=MyEvent<type1,ALARM>
>> *** BUG ***
>> insert MyEvent<type2,ALARM>
>> >>> f1=MyEvent<type2,ALARM> f2=MyEvent<type2,ALARM>
>> >>> f1=MyEvent<type2,ALARM> f2=MyEvent<type1,ALARM>
>> *** BUG ***
>> _______________________________________________
>> rules-dev mailing list
>> rules-dev <at> lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-dev
>>
>
>
>
> --
>   Edson Tirelli
>   JBoss Drools Core Development
>   JBoss by Red Hat  <at>  www.jboss.com
>
Attachment (length.tgz): application/x-gzip, 1122 bytes
_______________________________________________
rules-dev mailing list
rules-dev <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev
Edson Tirelli | 30 Jun 2012 03:16
Picon
Gravatar

Re: [rules-dev] Evil bug in 5.4.0: wrong fact selected by simple constraint due to window:length()


   Fixed. Thanks for reporting and providing test case.


   Edson

On Sun, Jun 24, 2012 at 1:56 AM, Wolfgang Laun <wolfgang.laun <at> gmail.com> wrote:
Here's the code for reproducing.

If there were a place in some file where I could add this by simply
editing a file I'd do it. (I know that it is possible - I've done it
once or twice on some doc XML.)

Cheers
Wolfgang


On 23/06/2012, Edson Tirelli <ed.tirelli <at> gmail.com> wrote:
>    Thanks Wolfgang, I will fix it asap. Traveling during the next week, but
> should not take long.
>
>    Edson
>
> On Sat, Jun 23, 2012 at 6:23 AM, Wolfgang Laun
> <wolfgang.laun <at> gmail.com>wrote:
>
>> It should be pretty obvious that the rule should not fire after the
>> insertion of a single fact.
>>
>> declare MyEvent
>> <at> role(event)
>> end
>>
>> rule FaultsCoincide
>> when
>>    f1 : MyEvent( key == "type1" ) over window:length( 1 )
>>    f2 : MyEvent( key == "type2" ) over window:length( 1 )
>> then
>>    System.out.println( ">>> f1=" + f1 + " f2=" + f2 );
>>    if( f2.getKey().equals( "type1" ) ) System.out.println( "*** BUG ***"
>> );
>> end
>>
>> insert MyEvent<type1,ALARM>
>> >>> f1=MyEvent<type1,ALARM> f2=MyEvent<type1,ALARM>
>> *** BUG ***
>> insert MyEvent<type2,ALARM>
>> >>> f1=MyEvent<type2,ALARM> f2=MyEvent<type2,ALARM>
>> >>> f1=MyEvent<type2,ALARM> f2=MyEvent<type1,ALARM>
>> *** BUG ***
>> _______________________________________________
>> rules-dev mailing list
>> rules-dev <at> lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-dev
>>
>
>
>
> --
>   Edson Tirelli
>   JBoss Drools Core Development
>   JBoss by Red Hat <at> www.jboss.com
>

_______________________________________________
rules-dev mailing list
rules-dev <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev




--
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat <at> www.jboss.com
_______________________________________________
rules-dev mailing list
rules-dev <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev

Gmane