You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2018/01/04 09:12:36 UTC

[incubator-plc4x] branch refactoring/java_generify updated (78780b9 -> 3d65ec7)

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

sruehl pushed a change to branch refactoring/java_generify
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git.


 discard 78780b9  Merge remote-tracking branch 'origin/master' into refactoring/java_generify
     add ce7eaee  fix build by adding missing apache headers
     new 3d65ec7  Merge branch 'master' into refactoring/java_generify

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (78780b9)
            \
             N -- N -- N   refs/heads/refactoring/java_generify (3d65ec7)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/plc4x/java/isotp/netty/MockChannel.java | 18 ++++++++++++++++++
 .../java/isotp/netty/MockChannelHandlerContext.java    | 18 ++++++++++++++++++
 .../plc4x/java/isotp/netty/MockChannelPipeline.java    | 18 ++++++++++++++++++
 sonar-project.properties                               | 17 +++++++++++++++++
 4 files changed, 71 insertions(+)

-- 
To stop receiving notification emails like this one, please contact
['"commits@plc4x.apache.org" <co...@plc4x.apache.org>'].

[incubator-plc4x] 01/01: Merge branch 'master' into refactoring/java_generify

Posted by sr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 3d65ec7143a5107bf771b944e3940bf476f1e44b
Merge: d4fdb5b ce7eaee
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Thu Jan 4 10:12:27 2018 +0100

    Merge branch 'master' into refactoring/java_generify
    
    # Conflicts:
    #	integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/PlcConnectionAdapter.java
    #	plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/Plc4XS7Protocol.java

 .gitignore                                         |   1 +
 .../apache/plc4x/edgent/PlcConnectionAdapter.java  |   2 +-
 .../plc4x/java/isotp/netty/IsoTPProtocol.java      |  25 +-
 .../plc4x/java/s7/connection/S7PlcConnection.java  |   2 +-
 .../plc4x/java/s7/netty/Plc4XS7Protocol.java       |  12 +-
 .../org/apache/plc4x/java/s7/netty/S7Protocol.java |   2 +-
 .../plc4x/java/isotp/netty/IsoTPProtocolTest.java  | 362 ++++++++++++++++++++-
 .../apache/plc4x/java/isotp/netty/MockChannel.java | 243 ++++++++++++++
 .../isotp/netty/MockChannelHandlerContext.java     | 234 +++++++++++++
 .../java/isotp/netty/MockChannelPipeline.java      | 354 ++++++++++++++++++++
 .../apache/plc4x/java/s7/S7PlcReaderSample.java    |   2 +-
 .../org/apache/plc4x/java/s7/S7PlcScanner.java     |   2 +-
 .../org/apache/plc4x/java/s7/S7PlcTestConsole.java |   2 +-
 .../apache/plc4x/java/s7/S7PlcWriterSample.java    |   2 +-
 sonar-project.properties                           |  46 +++
 src/site/asciidoc/development/building.adoc        |  82 +++++
 16 files changed, 1357 insertions(+), 16 deletions(-)

diff --cc integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/PlcConnectionAdapter.java
index 1a91c26,2bff661..ab55af8
--- a/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/PlcConnectionAdapter.java
+++ b/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/PlcConnectionAdapter.java
@@@ -53,17 -53,17 +53,17 @@@ import java.util.Calendar
   * support for multiple connections from a single client.
   * <p>
   * A single PlcConnectionAdapter can be used by multiple threads concurrently
 - * (e.g., used by multiple PlcFunctions Consumers for {@code Topology.poll()} and/or 
 - * multiple Suppliers for {@code TStream.sink()}). 
 - * 
 + * (e.g., used by multiple PlcFunctions Consumers for {@code Topology.poll()} and/or
 + * multiple Suppliers for {@code TStream.sink()}).
 + *
   * @see PlcFunctions
   */
 -public class PlcConnectionAdapter implements AutoCloseable{
 +public class PlcConnectionAdapter implements AutoCloseable {
  
-     private final static Logger logger = LoggerFactory.getLogger(PlcConnectionAdapter.class);
 -  private static final Logger logger = LoggerFactory.getLogger(PlcConnectionAdapter.class);
 -  
 -  private String plcConnectionUrl;
 -  private PlcConnection plcConnection;
++    private static final Logger logger = LoggerFactory.getLogger(PlcConnectionAdapter.class);
 +
 +    private String plcConnectionUrl;
 +    private PlcConnection plcConnection;
    
    /*
     * NOTES:
diff --cc plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/Plc4XS7Protocol.java
index 09eea8f,d234a46..ad46f53
--- a/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/Plc4XS7Protocol.java
+++ b/plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/netty/Plc4XS7Protocol.java
@@@ -294,13 -293,13 +294,13 @@@ public class Plc4XS7Protocol extends Me
          Class valueType = values[0].getClass();
          if (valueType == Boolean.class) {
              // TODO: Check if this is true and the result is not Math.ceil(values.lenght / 8)
-             result = new byte[values.length * 1];
+             result = new byte[values.length];
 -            for(int i = 0; i < values.length; i++) {
 +            for (int i = 0; i < values.length; i++) {
                  result[i] = (byte) (((Boolean) values[i]) ? 0x01 : 0x00);
              }
          } else if (valueType == Byte[].class) {
-             result = new byte[values.length * 1];
+             result = new byte[values.length];
 -            for(int i = 0; i < values.length; i++) {
 +            for (int i = 0; i < values.length; i++) {
                  result[i] = (byte) values[i];
              }
          } else if (valueType == Short.class) {
@@@ -355,22 -354,21 +355,22 @@@
          return ResponseCode.INTERNAL_ERROR;
      }
  
 -    private List<Object> decodeData(Class<?> datatype, byte[] s7Data) throws PlcProtocolException {
 -        if(s7Data.length == 0) {
 +    @SuppressWarnings("unchecked")
-     private <T> List<T> decodeData(Class<T> datatype, byte[] s7Data) {
++    private <T> List<T> decodeData(Class<T> datatype, byte[] s7Data) throws PlcProtocolException {
 +        if (s7Data.length == 0) {
              return null;
          }
          List<Object> result = new LinkedList<>();
-         for (int i = 0; i < s7Data.length; i++) {
 -        for(int i = 0; i < s7Data.length;) {
++        for (int i = 0; i < s7Data.length;) {
              if (datatype == Boolean.class) {
                  result.add((s7Data[i] & 0x01) == 0x01);
 -                i+=1;
 +                i += 1;
              } else if (datatype == Byte.class) {
                  result.add(s7Data[i]);
 -                i+=1;
 +                i += 1;
              } else if (datatype == Short.class) {
 -                result.add((short) (((s7Data[i] & 0xff) << 8) | (s7Data[i+1] & 0xff)));
 -                i+=2;
 +                result.add((short) (((s7Data[i] & 0xff) << 8) | (s7Data[i + 1] & 0xff)));
 +                i += 2;
              } else if (datatype == Integer.class) {
                  result.add((((s7Data[i] & 0xff) << 24) | ((s7Data[i + 1] & 0xff) << 16) |
                      ((s7Data[i + 2] & 0xff) << 8) | (s7Data[i + 3] & 0xff)));
@@@ -382,10 -380,12 +382,12 @@@
                  int intValue = (((s7Data[i] & 0xff) << 24) | ((s7Data[i + 1] & 0xff) << 16) |
                      ((s7Data[i + 2] & 0xff) << 8) | (s7Data[i + 3] & 0xff));
                  result.add(Float.intBitsToFloat(intValue));
 -                i+=4;
 +                i += 4;
+             } else {
+                 throw new PlcProtocolException("Unsupported datatype " + datatype.getSimpleName());
              }
          }
 -        return result;
 +        return (List<T>) result;
      }
  
  }

-- 
To stop receiving notification emails like this one, please contact
"commits@plc4x.apache.org" <co...@plc4x.apache.org>.