[
http://jira.jboss.com/jira/browse/JBRULES-1451?page=all ]
Edson Tirelli closed JBRULES-1451.
----------------------------------
Fix Version/s: 4.0.5
5.0.0-M1
Resolution: Done
Fixed.
Thanks for reporting.
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
Fix For: 4.0.5, 5.0.0-M1
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