Skip to content

Commit f894814

Browse files
committed
Fixing bug that caused units not being retrieved under certain circumstances.
1 parent 669b241 commit f894814

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

pvAccessJava/src/org/epics/ca/BaseV3ChannelStructure.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,10 @@ public PVStructure createPVStructure(PVStructure pvRequest,boolean propertiesAll
220220
nativeDBRType = DBRType.STRING;
221221
}
222222
}
223-
String[] propertyNames = new String[propertyList.size()];
224-
for(int i=0; i<propertyNames.length; i++) propertyNames[i] = propertyList.get(i);
223+
225224
DBRProperty dbrProperty = DBRProperty.none;
226-
if(propertyNames.length>0) {
227-
for(String propertyName : propertyNames) {
225+
if(propertyList.size()>0) {
226+
for(String propertyName : propertyList) {
228227
if(propertyName.equals("alarm")&& (dbrProperty.compareTo(DBRProperty.status)<0)) {
229228
dbrProperty = DBRProperty.status;
230229
continue;
@@ -911,15 +910,18 @@ public void toStructure(DBR fromDBR) {
911910
String message = status.getName();
912911
setAlarm(statusMap.get(status),alarmSeverity,message);
913912
}
914-
if(displayLow<displayHigh) {
913+
if(units!=null) {
915914
pvStructure = this.pvStructure.getStructureField("display");
916915
if(pvStructure!=null) {
917-
if(units!=null) {
918916
PVString pvUnits = pvStructure.getStringField("units");
919917
if(pvUnits!=null) {
920918
pvUnits.put(units.toString());
921919
}
922920
}
921+
}
922+
if(displayLow<displayHigh) {
923+
pvStructure = this.pvStructure.getStructureField("display");
924+
if(pvStructure!=null) {
923925
PVDouble pvLow = pvStructure.getDoubleField("limitLow");
924926
PVDouble pvHigh = pvStructure.getDoubleField("limitHigh");
925927
if(pvLow!=null && pvHigh!=null) {

0 commit comments

Comments
 (0)