You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2020/07/13 10:40:15 UTC
[plc4x] 01/02: PLC4X-212 - When writing multiple values in one
request the item status is not correctly set - Unfortunately when
assembling the merged write response,
it iterated over the fields of the original request and not the
sub-requests.
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch feature/knx-read-write-support
in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit 4e661b46fa4f69898535b9e90615d470216a0b08
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Mon Jul 13 12:34:57 2020 +0200
PLC4X-212 - When writing multiple values in one request the item status is not correctly set
- Unfortunately when assembling the merged write response, it iterated over the fields of the original request and not the sub-requests.
---
.../main/java/org/apache/plc4x/java/spi/optimizer/BaseOptimizer.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/optimizer/BaseOptimizer.java b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/optimizer/BaseOptimizer.java
index 3c252f4..c031710 100644
--- a/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/optimizer/BaseOptimizer.java
+++ b/plc4j/spi/src/main/java/org/apache/plc4x/java/spi/optimizer/BaseOptimizer.java
@@ -68,8 +68,9 @@ public abstract class BaseOptimizer {
Map<PlcRequest, Either<PlcResponse, Exception>> writeResponses) {
Map<String, PlcResponseCode> fields = new HashMap<>();
for (Map.Entry<PlcRequest, Either<PlcResponse, Exception>> requestsEntries : writeResponses.entrySet()) {
+ PlcWriteRequest subWriteRequest = (PlcWriteRequest) requestsEntries.getKey();
Either<PlcResponse, Exception> writeResponse = requestsEntries.getValue();
- for (String fieldName : writeRequest.getFieldNames()) {
+ for (String fieldName : subWriteRequest.getFieldNames()) {
if (writeResponse.isLeft()) {
PlcWriteResponse subWriteResponse = (PlcWriteResponse) writeResponse.getLeft();
fields.put(fieldName, subWriteResponse.getResponseCode(fieldName));