Skip to content

Commit e183dd8

Browse files
committed
#9 During a put only check the structures actually being copied.
1 parent c0c9272 commit e183dd8

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,14 @@ public int get(int offset, int len, StructureArrayData data) {
7676
@Override
7777
public int put(int offset, int len, PVStructure[] from, int fromOffset) {
7878

79-
// first check if all the PVStructure-s are of the right type
79+
// first check if the PVStructure-s being written are of the right type
8080
Structure elementField = structureArray.getStructure();
81-
for (PVStructure pvs : from)
82-
if (pvs != null && !pvs.getStructure().equals(elementField))
83-
throw new IllegalStateException("element is not a compatible structure");
8481

82+
for (int i = 0; i < len; i++) {
83+
PVStructure pvs = from[i];
84+
if (pvs != null && !pvs.getStructure().equals(elementField))
85+
throw new IllegalStateException("element is not a compatible structure");
86+
}
8587
return internalPut(offset, len, from, fromOffset);
8688
}
8789

0 commit comments

Comments
 (0)