empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Döbele (JIRA) <empire-db-...@incubator.apache.org>
Subject [jira] [Commented] (EMPIREDB-171) ObjectUtils.compareEquals fails on BigDecimal
Date Tue, 02 Oct 2012 18:07:07 GMT

    [ https://issues.apache.org/jira/browse/EMPIREDB-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13467916#comment-13467916
] 

Rainer Döbele commented on EMPIREDB-171:
----------------------------------------

In math I would have failed if I had agrued that 2.0 is not equal to 2.00. I really wonder
who came up with that idea to implment the equals method for BigDecimals that way.
But let's review the facts: 2 Methods (compareTo and equals) that someone would normaly assume
to behave in the same way, behave differently.
Now our method is called compareEqual().
Hence we must decide whether we want the compare logic or the equals logic.
And since the function tries to match values even of different data types, it is obvious for
me that for BigDecimals we need the compare logic.

                
> ObjectUtils.compareEquals fails on BigDecimal
> ---------------------------------------------
>
>                 Key: EMPIREDB-171
>                 URL: https://issues.apache.org/jira/browse/EMPIREDB-171
>             Project: Empire-DB
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: empire-db-2.4.0
>            Reporter: Daniel Weidele
>            Priority: Critical
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Observed:
> When comparing a BigDecimal with internal value e.g. '50' to another BigDecimal with
internal value '50.00' ObjectUtils.compareEquals returns false as it internally forwards to
the BigDecimal.equals method, which also relies on internal BigDecimal properties such as
scale, etc.
> Expected:
> ObjectUtils.compareEquals should return true when comparing e.g. '50' to '50.00'

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message