Skip to content

Commit 479f2f8

Browse files
committed
Fix bug in PVStructure equals() method
equals() was returning true if two structures had the same number of fields, of equal type and equal value data, even if type IDs or field names were not equal - correct this.
1 parent 77ce235 commit 479f2f8

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

pvDataJava/src/org/epics/pvdata/factory/BasePVStructure.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,13 +455,16 @@ public boolean equals(Object obj) {
455455
// TODO anything else?
456456
if (obj instanceof PVStructure) {
457457
PVStructure b = (PVStructure)obj;
458+
if (!getStructure().equals(b.getStructure()))
459+
return false;
460+
458461
final PVField[] bfields = b.getPVFields();
459462
if (bfields.length == pvFields.length)
460463
{
461464
for (int i = 0; i < pvFields.length; i++)
462465
if (!pvFields[i].equals(bfields[i]))
463466
return false;
464-
467+
465468
return true;
466469
}
467470
else

0 commit comments

Comments
 (0)