You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Duncan Jones (JIRA)" <ji...@apache.org> on 2016/12/12 15:28:58 UTC

[jira] [Closed] (LANG-872) EqualsBuilder methods append(Object[],Object[]) and append(Object,Object) treats array class dirrerently

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

Duncan Jones closed LANG-872.
-----------------------------
       Resolution: Not A Problem
         Assignee: Duncan Jones
    Fix Version/s:     (was: Discussion)

I've added an explanation to the Javadoc to explain how {{append(Object[],Object[])}} works. I think that's sufficient to resolve this issue.

Please re-open and comment if you disagree!.

{quote}
Repository: commons-lang
Updated Branches:
 refs/heads/master 31fcd3bd8 -> f13d18cff


Javadoc change to address LANG-872. 

Javadocs for append(Object[],Object[]) updated to indicate it only
compares the contents of the arrays, not the type of the arrays.

Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/f13d18cf
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/f13d18cf
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/f13d18cf
{quote}

> 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
>            Assignee: Duncan Jones
>            Priority: Minor
>         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.3.4#6332)