[
https://jira.jboss.org/jira/browse/JBRULES-1654?page=com.atlassian.jira.p...
]
Mark Proctor updated JBRULES-1654:
----------------------------------
Fix Version/s: 4.0.8
(was: 5.0.0.M5)
This works in 5.0.x. Turns out it's an issue with older versions of MVEL, this will be
fixed in 4.0.x by upgrading to latest MVEL. I've added unit tests to 5.0.x anyway, to
detect regressions.
eval() Incorrectly Evaluating BigDecimal to False
-------------------------------------------------
Key: JBRULES-1654
URL:
https://jira.jboss.org/jira/browse/JBRULES-1654
Project: JBoss Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: 4.0.7
Reporter: Andrew Frederico
Assignee: Edson Tirelli
Fix For: 4.0.8
Even when the condition of an eval() in the "where" block results in TRUE when
used in normal code the rule does not fire directly because of the eval() statement.
My class definition:
class BuyOffer() {
private BigDecimal amount;
...
}
The getter from the class:
public BigDecimal getAmount() {
return amount;
}
Assuming that I've setAmount() to something non-zero earlier in the code, the line of
code that evaluates to TRUE (verified by System.outing the result):
buyOffer.getAmount().compareTo(BigDecimal.ZERO) > 0
My eval() statement:
eval( buyOffer.getAmount().compareTo(BigDecimal.ZERO) > 0 )
With eval() in place the rule does NOT fire. When removed it DOES and the following line
of code prints TRUE.
System.out.printf("buyOffer.getAmount().compareTo(BigDecimal.ZERO) > 0:
%s\n", buyOffer.getAmount().compareTo(BigDecimal.ZERO) > 0);
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira