commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Yandell (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (LANG-872) EqualsBuilder methods append(Object[],Object[]) and append(Object,Object) treats array class dirrerently
Date Mon, 21 Oct 2013 19:39:49 GMT

     [ https://issues.apache.org/jira/browse/LANG-872?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Henri Yandell updated LANG-872:
-------------------------------

    Fix Version/s: Discussion

> EqualsBuilder methods append(Object[],Object[]) and append(Object,Object) treats array
class dirrerently
> --------------------------------------------------------------------------------------------------------
>
>                 Key: LANG-872
>                 URL: https://issues.apache.org/jira/browse/LANG-872
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.builder.*
>    Affects Versions: 2.6, 3.1
>            Reporter: Algirdas Raščius
>            Priority: Minor
>             Fix For: Discussion
>
>         Attachments: commons-lang3-LANG-872.patch
>
>
> Method {{EqualsBuilder.append(Object[],Object[])}} ignores classes of passed arrays and
returns true if contents of both arrays are equal.
> Method {{EqualsBuilder.append(Object,Object)}} returns false immediately if types of
passed array arguments are different.
> For example:
> {code}
>     public void testEqualsArrays() {
>         Object[] aArray = new Object[] {"Value"};
>         Object[] bArray = new String[] {"Value"};
>         boolean compareAsArrays = new EqualsBuilder().append(aArray, bArray).isEquals();
>         // compareAsArrays is true
>         Object aObj  = aArray;
>         Object bObj  = bArray;
>         boolean compareAsObjects = new EqualsBuilder().append(aObj, bObj).isEquals();
>         // compareAsObjects is false
>         assertTrue(compareAsArrays == compareAsObjects); //Fails
>     }
> {code}
> Results of both methods should be consistent.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message