Skip to content

Commit 055569f

Browse files
authored
Merge pull request #20 from epics-base/Issue_9
Issue #9
2 parents 72bca67 + 79efc60 commit 055569f

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

gpclient/gpclient-core/src/main/java/org/epics/gpclient/PVReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
* @author carcassi
4545
* @param <T> the type of the PVReader.
4646
*/
47-
public interface PVReader<T> {
47+
public interface PVReader<T> extends AutoCloseable {
4848

4949
/**
5050
* Returns the current value of the PVReader.

gpclient/gpclient-core/src/main/java/org/epics/gpclient/PVWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* @param <T> type of the write payload
1818
* @author carcassi
1919
*/
20-
public interface PVWriter<T> {
20+
public interface PVWriter<T> extends AutoCloseable {
2121

2222
/**
2323
* Writes a new value asynchronously using the default callback. The result

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)