This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch dev
in repository
https://gitbox.apache.org/repos/asf/incubator-streampipes-extensions.git
The following commit(s) were added to refs/heads/dev by this push:
new 731af55 Fix null pointer in modbus adapter
731af55 is described below
commit 731af55bf822e11772a41ef8f07f81f3222af824
Author: Philipp Zehnder <[email protected]>
AuthorDate: Fri Jul 17 10:56:36 2020 +0200
Fix null pointer in modbus adapter
---
.../connect/adapters/plc4x/modbus/Plc4xModbusAdapter.java | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git
a/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/adapters/plc4x/modbus/Plc4xModbusAdapter.java
b/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/adapters/plc4x/modbus/Plc4xModbusAdapter.java
index 195e8fa..7abb9ba 100644
---
a/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/adapters/plc4x/modbus/Plc4xModbusAdapter.java
+++
b/streampipes-connect-adapters/src/main/java/org/apache/streampipes/connect/adapters/plc4x/modbus/Plc4xModbusAdapter.java
@@ -286,7 +286,8 @@ public class Plc4xModbusAdapter extends PullAdapter{
// Create an event containing the value of the PLC
Map<String, Object> event = new HashMap<>();
for (Map<String, String> node : this.nodes) {
- if (response.getResponseCode(node.get(PLC_NODE_ID)) ==
PlcResponseCode.OK) {
+ // TODO node does not contain node id, alternative: node
address is an integer and no string
+// if (response.getResponseCode(node.get(PLC_NODE_ID)) ==
PlcResponseCode.OK) {
switch (node.get(PLC_NODE_TYPE)){
case
"Coil":event.put(node.get(PLC_NODE_RUNTIME_NAME), response.getBoolean("Coil-" +
String.valueOf(node.get(PLC_NODE_ADDRESS))));break;
@@ -297,11 +298,11 @@ public class Plc4xModbusAdapter extends PullAdapter{
event.put(node.get(PLC_NODE_RUNTIME_NAME),
response.getInteger("HoldingRegister-" +
String.valueOf(node.get(PLC_NODE_ADDRESS))));break;
}
}
- else {
- logger.error("Error[" + node.get(PLC_NODE_ID) +
"]: " +
-
response.getResponseCode(node.get(PLC_NODE_ID)));
- }
- }
+// else {
+// logger.error("Error[" + node.get(PLC_NODE_ID) +
"]: " +
+//
response.getResponseCode(node.get(PLC_NODE_ID)));
+// }
+// }
// publish the final event
adapterPipeline.process(event);