diff --git a/pom.xml b/pom.xml index 3228abee69e250d51be2ab320313f83be025ada1..9231d150479d34f0c427ba001af3e58af682433e 100755 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ <groupId>fr.soleil.deviceservers</groupId> <artifactId>OpcUaProxy</artifactId> - <version>1.1.5</version> + <version>1.1.6</version> <name>OpcUaProxy</name> <description>Proxy device between OPCUA and Tango</description> diff --git a/src/main/java/fr/soleil/opcuaproxy/attributes/OpcUaTangoUtils.java b/src/main/java/fr/soleil/opcuaproxy/attributes/OpcUaTangoUtils.java index d0ec5c9fa01bee9d650f75b9d4273f65b7cd72f9..a5f9b6a08ef692209713c08dc972cf50f6b5b53e 100755 --- a/src/main/java/fr/soleil/opcuaproxy/attributes/OpcUaTangoUtils.java +++ b/src/main/java/fr/soleil/opcuaproxy/attributes/OpcUaTangoUtils.java @@ -1,6 +1,7 @@ package fr.soleil.opcuaproxy.attributes; import java.lang.reflect.Array; +import java.math.BigInteger; import java.time.Instant; import java.util.ArrayList; import java.util.HashMap; @@ -38,8 +39,8 @@ public abstract class OpcUaTangoUtils { } public static class FullTangoType { - private AttrDataFormat format; - private AttributeTangoType type; + private final AttrDataFormat format; + private final AttributeTangoType type; public FullTangoType(AttributeTangoType type, AttrDataFormat format) { super(); @@ -119,8 +120,7 @@ public abstract class OpcUaTangoUtils { format = AttrDataFormat.IMAGE; if (Array.getLength(opcuaValue) > 0) { Class<? extends Object> imgInnerClass = extractArrayInnerClass(Array.get(opcuaValue, 0)); - AttributeTangoType tangoImgType = getTangoBasicType(imgInnerClass, nullIfNative); - tangoArrayType = tangoImgType; + tangoArrayType = getTangoBasicType(imgInnerClass, nullIfNative); } } if (tangoArrayType != null) { @@ -129,8 +129,7 @@ public abstract class OpcUaTangoUtils { } else if (!nullIfNative) { try { fullTangoType = new FullTangoType(AttributeTangoType.getTypeFromClass(opcuaClass), format); - } catch (DevFailed e) { - fullTangoType = null; + } catch (DevFailed ignored) { } } } else { @@ -144,8 +143,7 @@ public abstract class OpcUaTangoUtils { if (tangoType == null && !nullIfNative) { try { tangoType = AttributeTangoType.getTypeFromClass(clazz); - } catch (DevFailed e) { - tangoType = null; + } catch (DevFailed ignored) { } } return tangoType; @@ -190,9 +188,10 @@ public abstract class OpcUaTangoUtils { } else if (opcuaClass == UShort.class) { opcuaValue = UShort.valueOf(((Short) tangoValue).shortValue()); } else if (opcuaClass == UInteger.class) { - opcuaValue = UInteger.valueOf(((Integer) tangoValue).longValue()); + opcuaValue = UInteger.valueOf(Integer.toUnsignedLong((Integer) tangoValue)); } else if (opcuaClass == ULong.class) { - opcuaValue = ULong.valueOf(((Long) tangoValue).longValue()); + BigInteger bi = new BigInteger(Long.toUnsignedString((Long)tangoValue)); + opcuaValue = ULong.valueOf(bi); } else if (opcuaClass == DateTime.class) { opcuaValue = new DateTime(Instant.parse((String) tangoValue)); } else if (opcuaClass == NodeId.class) {