[rules-users] NullPointerException when using bean property which happens to be a Enum name

Sean Su sean.x.su at gmail.com
Thu Apr 18 13:32:11 EDT 2013


Yes, I was in the middle of writing a clarification email.

The DSL side would be fine if I change it to myEnum (to follow the bean
standard).

Yes, Guvnor side did not change it to lower case. Note, I actually have my
Enum as MYEnum (more than one upper case). Guvnor translated the getMYEnum
to MYEnum as the bean property, which seems to be a bug.

Thanks

Sean


On Thu, Apr 18, 2013 at 1:28 PM, Davide Sottara <dsotty at gmail.com> wrote:

>  Thanks, it deserves investigation. There seems to be at least a bug in
> Guvnor -
> it should create a constraint such as :
>
> Foo( myEnum == MyEnum.someitem )
>
>
>
> On 04/18/2013 10:19 AM, Sean Su wrote:
>
> I am using 5.5.0.Final and I think I may have run into a bug.
>
>  Assuming I have a class Foo  that has a getter which is getMyEnum().
>
>  Also I have a Enum class which happens to have the name MyEnum.
>
>  When writing rules, I have
>
>  $foo : Foo (MyEnum == MyEnum.someItem)
>
>  This line will throw NullPointerException.
>
>  I have to write it as:
>  $foo : Foo (getMyEnum() == MyEnum.someItem)
>
>  This statement will work just fine.
>
>  The workaround is ok for DRL. However I tested this on Guvnor and the
> rule editor would generate the DRL just like the first statement (MyEnum ==
> MyEnum.someItem). So we would be out of luck there.
>
>  Has anyone ever ran into this before.
>
>  Thanks
>
>  Sean
>
>
>
>
> _______________________________________________
> rules-users mailing listrules-users at lists.jboss.orghttps://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130418/1f5cfd66/attachment-0001.html 


More information about the rules-users mailing list