[jboss-jira] [JBoss JIRA] Created: (JBRULES-1451) LHS expression comparing a Boolean to a String does not fail but always returns true
Len Carlsen (JIRA)
jira-events at lists.jboss.org
Wed Feb 6 18:57:03 EST 2008
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.4, 4.0.3
Environment: Eclipse IDE Version: 3.3.0 Build id: M20070921-1145
Windows XP Professional SP2
Reporter: Len Carlsen
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