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 2018/09/26 20:48:57 UTC

[incubator-plc4x] branch master updated: PLC4X-56 - [S7] S7Field does not recognize addresses with numElements present

This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git


The following commit(s) were added to refs/heads/master by this push:
     new e31e741  PLC4X-56 - [S7] S7Field does not recognize addresses with numElements present
e31e741 is described below

commit e31e741616c8b771b3b35d6dac8507287f69525b
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Wed Sep 26 16:48:54 2018 -0400

    PLC4X-56 - [S7] S7Field does not recognize addresses with numElements present
    
    - Fixed an error in the regular expression for parsing the number of elements. Old version could only read a 0-9 items ... is now fixed.
---
 .../s7/src/main/java/org/apache/plc4x/java/s7/model/S7Field.java      | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/model/S7Field.java b/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/model/S7Field.java
index 8d48c78..1b83374 100644
--- a/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/model/S7Field.java
+++ b/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/model/S7Field.java
@@ -29,9 +29,9 @@ import java.util.regex.Pattern;
 public class S7Field implements PlcField {
 
     private static final Pattern ADDRESS_PATTERN =
-        Pattern.compile("^%(?<memoryArea>.)(?<transferSizeCode>[XBWD]?)(?<byteOffset>\\d{1,4})(.(?<bitOffset>[0-7]))?:(?<dataType>.+)(\\[(?<numElements>\\d)])?");
+        Pattern.compile("^%(?<memoryArea>.)(?<transferSizeCode>[XBWD]?)(?<byteOffset>\\d{1,4})(.(?<bitOffset>[0-7]))?:(?<dataType>[a-z,A-Z]+)(\\[(?<numElements>\\d+)])?");
     private static final Pattern DATA_BLOCK_ADDRESS_PATTERN =
-        Pattern.compile("^%DB(?<blockNumber>\\d{1,4}).DB(?<transferSizeCode>[XBWD]?)(?<byteOffset>\\d{1,4})(.(?<bitOffset>[0-7]))?:(?<dataType>.+)(\\[(?<numElements>\\d)])?");
+        Pattern.compile("^%DB(?<blockNumber>\\d{1,4}).DB(?<transferSizeCode>[XBWD]?)(?<byteOffset>\\d{1,4})(.(?<bitOffset>[0-7]))?:(?<dataType>[a-z,A-Z]+)(\\[(?<numElements>\\d+)])?");
 
     public static boolean matches(String fieldString) {
         return DATA_BLOCK_ADDRESS_PATTERN.matcher(fieldString).matches() ||