[jboss-jira] [JBoss JIRA] Commented: (JBRULES-1451) LHS expression comparing a Boolean to a String does not fail but always returns true
Edson Tirelli (JIRA)
jira-events at lists.jboss.org
Thu Feb 7 08:14:03 EST 2008
[ http://jira.jboss.com/jira/browse/JBRULES-1451?page=comments#action_12398682 ]
Edson Tirelli commented on JBRULES-1451:
----------------------------------------
Sorry, I meant:
Boolean.FALSE.booleanValue() == Boolean.valueOf( "foo" ).booleanValue()
> LHS expression comparing a Boolean to a String does not fail but always returns true
> ------------------------------------------------------------------------------------
>
> Key: JBRULES-1451
> URL: http://jira.jboss.com/jira/browse/JBRULES-1451
> Project: JBoss Drools
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 4.0.3, 4.0.4
> Environment: Eclipse IDE Version: 3.3.0 Build id: M20070921-1145
> Windows XP Professional SP2
> Reporter: Len Carlsen
> Assigned To: Edson Tirelli
>
> LHS expression comparing a Boolean to a String does not fail but always returns true.
> Example:
> --------------------------------------------------------------------------------------------------------------------------
> Modified the Drools HelloWorldExample and changed the status from an int to a boolean.
> import org.drools.examples.HelloWorldExample.Message;
> rule "Hello World"
> when
> m : Message( status == "hello", message : message )
> then
> System.out.println( message );
> end
> public static class Message {
> public static final boolean HELLO = false;
> public static final boolean GOODBYE = true;
> private String message;
> private Boolean status;
> public Message() {}
> public String getMessage() { return this.message; }
> public void setMessage(final String message) { this.message = message; }
> public boolean getStatus() { return this.status; }
> public void setStatus(final boolean status) { this.status = status; }
> }
> final Message message = new Message();
> message.setMessage( "Hello World" );
> message.setStatus( Message.HELLO );
> final StatefulSession session = ruleBase.newStatefulSession();
> session.insert( message );
> session.fireAllRules();
--
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