[
https://issues.apache.org/jira/browse/LANG-872?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Duncan Jones updated LANG-872:
--
Attachment: commons-lang3-LANG-872.patch
Looks like a bug to me. Attached is a patch that incorporates your test (just
changed the {{assertTrue}} to {{assertEquals}}) and a fix to {{EqualsBuilder}}.
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
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 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