[jboss-jira] [JBoss JIRA] Resolved: (JBRULES-954) '==' & '!=' not working properly with globals

Edson Tirelli (JIRA) jira-events at lists.jboss.org
Thu Jun 28 18:36:04 EDT 2007


     [ http://jira.jboss.com/jira/browse/JBRULES-954?page=all ]

Edson Tirelli resolved JBRULES-954.
-----------------------------------

    Fix Version/s:  4.0.0.MR4
       Resolution: Duplicate Issue

This seems to be the same problem reported in JBRULES-953. After fixing 953, I was not able to reproduce the problem. 

Can you please test and if you continue to see the problem, re-open this ticket?

Thank you for reporting.

> '==' & '!=' not working properly with globals
> ---------------------------------------------
>
>                 Key: JBRULES-954
>                 URL: http://jira.jboss.com/jira/browse/JBRULES-954
>             Project: JBoss Rules
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Drl Parser/Builder
>    Affects Versions:  4.0.0.MR3
>         Environment: Windows XP, Drools MR3
>            Reporter: Brian Enderle
>         Assigned To: Edson Tirelli
>             Fix For:  4.0.0.MR4
>
>
> The equality operators (== & !=) are not working correctly when comparing a value to a global.  This holds true for globals of the type java.lang.Character, java.lang.String and java.lang.Long (only ones I tested, but probably others as well).
> Given:
> Person object with sex set to 'M'
> rule "Must be male"
>    when
>       $p : Person ( sex == 'M' )
>    then
>       System.out.println ( "- This is a man" );
> end
> rule "Cannot be a man"
>    when
>       $p : Person ( sex != 'M')
>    then
>       System.out.println ( "- This must be a woman")
> end
> Results:
> - This is a man
> If we replace the 'M' with the global "maleCode" and set it to 'M' in our calling program then,
> gloabl java.lang.Character maleCode;
> rule "Must be male"
>    when
>       $p : Person ( sex == maleCode )
>    then
>       System.out.println ( "- This is a man" );
> end
> rule "Cannot be a man"
>    when
>       $p : Person ( sex != maleCode)
>    then
>       System.out.println ( "- This must be a woman")
> end
> Results:
> - This is a man
> - This must be a woman
> Both rules are passing when one, the latter, should fail
> Brian Enderle

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list