[rules-users] possible bug in latest SNAPSHOT - AccumulateFunction.init() is called when calling modify()
Salaboy
salaboy at gmail.com
Wed May 12 09:25:16 EDT 2010
Could be that the modify make the rule condition to be no longer true,
and for that reason the acumulation is zero in that point? I would
like to try it but I'm in my cell phone.
- Ing. Mauricio Salatino -
On May 12, 2010, at 6:58, Michal Bali <michalbali at gmail.com> wrote:
> Hi,
>
> I may have found a bug with accumulate and 'modify(..)' function
> call. It seems that once the modify(..) is called it indirectly
> calls AccumulateFunction.init() which invalidates accumulated data.
> I have included a simple test case:
>
> I am using the latest snapshot of Drools 5.1.SNAPSHOT
>
> I have created a sample Drools project and just modified the
> Sample.drl with this:
> -------------------------------------------------------------
> import java.util.List;
> import java.util.ArrayList;
>
> declare Holder
> list : List
> end
>
> rule "Hello World"
> when
> m : Message( )
> then
> insert(new Holder());
> end
>
> rule "GoodBye"
> when
> $holder : Holder( list == null )
> $messages : List() from accumulate(
> $message: Message(), collectList($message) )
> then
> System.out.println($messages); //<-- here the $messages list has
> one element
> modify($holder) {
> setList($messages)
> }
> System.out.println($messages); //<-- here the $messages list is
> empty
> end
> -----------------------------------------------------
>
> Let me know if you need more information. I can create a JIRA if
> needed.
>
> Thank you!
> Best regards,
> Michal
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
More information about the rules-users
mailing list