[rules-users] unexpected/spurious ClassCastException

Davide Sottara dsotty at gmail.com
Wed Jul 9 09:41:10 EDT 2014


Sorry for not being able to get back to you again earlier.
Yes, the rule / query you are showing makes sense - I would have asked
you for something similar :) It is definitely a bug in the resolution of
the class that defines an attribute, we could really use the reproducer
to fix it quickly.

I'll check the "enabled" attribute's behavior in 6.x
Thanks
Davide


On 07/07/2014 06:11 PM, Borris wrote:
> On Monday 07/07/2014 23:26, Davide Sottara wrote:
>> I'll try to reproduce the exception with the rule and the data model.
>> Meanwhile, could you share a self-contained unit test that reproduces
>> the problem?
>> That would speed up the fix process
>> Thanks!
>> Davide
> Hmm. Worked out what is happening. The exception is triggered by these:
>
> rule handleComplexFoodItemClash
>      enabled false
>      when
>          $first: ContextFoodItem( $item, true; )
>          $second: ContextFoodItem( this != $item, avoid == false )
>          isExampleOf( $second, $first; )
>      then
>          retract($second);
> end
>
> query isExampleOf (FoodItem $subject, FoodItem $category)
>      (
>          eval($subject == $category)
>      )
>      or
>      (
>          BroaderNarrower($broader, $subject;)
>          and
>          ?isExampleOf($broader, $category;)
>      )
> end
>
> This is the last thing I was playing with, so maybe not surprising 
> there's an error (the exception arises because of the isExampleOf query 
> and is a simple bug for me to fix).
>
> BUT BUT BUT I have "enabled false" as a rule attribute. Am I missing 
> something - I expected this to mean that the when part is never 
> evaluated, but it looks more like the when part is evaluated but 
> consequences are not added to the agenda. The documentation is 
> sufficiently terse that both viewpoints could be argued :(
>
> Borris
>
> _______________________________________________
> 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