You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@plc4x.apache.org by GitBox <gi...@apache.org> on 2018/09/27 10:49:42 UTC

[GitHub] sruehl commented on a change in pull request #25: PLC4X-57 Bugfix

sruehl commented on a change in pull request #25: PLC4X-57 Bugfix
URL: https://github.com/apache/incubator-plc4x/pull/25#discussion_r220877060
 
 

 ##########
 File path: plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/Plc4XS7Protocol.java
 ##########
 @@ -420,22 +423,29 @@ private PlcResponse decodeReadResponse(S7ResponseMessage responseMessage, PlcReq
             FieldItem fieldItem = null;
             ByteBuf data = Unpooled.wrappedBuffer(payloadItem.getData());
             if (responseCode == PlcResponseCode.OK) {
+                // TODO 2018-09-27 jf: array returning only implemented for BOOL, BYTE, INTEGERS, FP
+                // not for CHARS & STRINGS and not for all other bit-strings except for BYTE
                 switch (field.getDataType()) {
                     // -----------------------------------------
                     // Bit
                     // -----------------------------------------
                     case BOOL: {
-                        byte byteValue = data.readByte();
-                        fieldItem = new S7BooleanFieldItem(field.getDataType(),byteValue != 0x00);
+                        Boolean[] booleans = readAllValues(field, i -> data.readByte() != 0x00).toArray(new Boolean[field.getNumElements()]);
 
 Review comment:
   actually sonar finds a presized array as a bug: see here https://stackoverflow.com/a/29444594/850036

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services