[jboss-jira] [JBoss JIRA] Updated: (JBRULES-1654) eval() Incorrectly Evaluating BigDecimal to False

Andrew Frederico (JIRA) jira-events at lists.jboss.org
Sat Jun 21 15:13:37 EDT 2008


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

Andrew Frederico updated JBRULES-1654:
--------------------------------------

    Component/s:     (was: Decision tables)

> eval() Incorrectly Evaluating BigDecimal to False
> -------------------------------------------------
>
>                 Key: JBRULES-1654
>                 URL: http://jira.jboss.com/jira/browse/JBRULES-1654
>             Project: JBoss Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 4.0.7
>            Reporter: Andrew Frederico
>         Assigned To: Mark Proctor
>
> 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: 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