commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicolas Mommaerts (JIRA)" <j...@apache.org>
Subject [jira] Issue Comment Edited: (LANG-393) EqualsBuilder don't compare BigDecimals correctly
Date Wed, 01 Oct 2008 13:25:44 GMT

    [ https://issues.apache.org/jira/browse/LANG-393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12636021#action_12636021
] 

dfuse edited comment on LANG-393 at 10/1/08 6:25 AM:
-----------------------------------------------------------------

The following simple test case shows that the applied patch throws a ClassCastException:
public static void main(String[] args) {
		class Test {
			public Object o;
		}

		BigDecimal d = new BigDecimal(1000);
		Long l = new Long(1000);

		Test t1 = new Test();
		Test t2 = new Test();

		t1.o = d;
		t2.o = l;

		System.out.println(EqualsBuilder.reflectionEquals(t1, t2));
	}


      was (Author: dfuse):
    The following simple test case shows that the applied patch throws a ClassCastException:
public static void main(String[] args) {
		class Test {
			public Object o;
		}

		BigDecimal d = new BigDecimal(1000);
		Long l = new Long(1000);

		Test t1 = new Test();
		Test t2 = new Test();

		t1.o = d;
		t2.o = l;

		System.out.println(t1.o);

		System.out.println(EqualsBuilder.reflectionEquals(t1, t2));
	}

  
> EqualsBuilder don't compare BigDecimals correctly 
> --------------------------------------------------
>
>                 Key: LANG-393
>                 URL: https://issues.apache.org/jira/browse/LANG-393
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.3
>            Reporter: Luis Henriques
>            Priority: Minor
>             Fix For: 2.4
>
>         Attachments: LANG-393.patch
>
>
> When comparing a BigDecimal, the comparing is made using equals, not compareTo, which
is more appropriate in the case of BigDecimal.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message