United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-5095277 CompositeDataSupport.equals does not compare arrays element-by-element
JDK-5095277 : CompositeDataSupport.equals does not compare arrays element-by-element

Details
Type:
Bug
Submit Date:
2004-09-01
Status:
Resolved
Updated Date:
2005-05-14
Project Name:
JDK
Resolved Date:
2005-05-14
Component:
core-svc
OS:
generic
Sub-Component:
javax.management
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports
Relates:

Sub Tasks

Description
If you call cd1.equals(cd2), where cd1 is a CompositeDataSupport and cd2 is an object implementing CompositeData (e.g. another CompositeDataSupport), and if cd1 and cd2 have the same CompositeType that includes at least one item of type ArrayType, then the contents of each such array should be compared element by element.  Currently only the array identities are compared, which means that equals returns true if the two objects refer to the same array but not if they refer to different arrays with the same contents.

                                    

Comments
EVALUATION

Straightforward to fix using java.util.Arrays.deepEquals.
###@###.### 2004-09-01
                                     
2004-09-01
WORK AROUND

Test equality yourself by using a loop that compares the items in each CompositeData, using Arrays.equals for array items.
###@###.### 2004-09-01
                                     
2004-09-01
SUGGESTED FIX

Use Arrays.equals to compare the array contents.
###@###.### 2004-09-01
                                     
2004-09-01
PUBLIC COMMENTS

.
                                     
2004-09-02
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
mustang


                                     
2004-09-02



Hardware and Software, Engineered to Work Together