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

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


The following commit(s) were added to refs/heads/feature/Beckhoff_ADS_protocol 
by this push:
     new eb4482f  get rid of Optional as field
eb4482f is described below

commit eb4482f51e439271f92fd6c8b9bac46fee6f26e1
Author: Sebastian Rühl <sru...@apache.org>
AuthorDate: Fri Feb 2 14:19:17 2018 +0100

    get rid of Optional as field
---
 .../org/apache/plc4x/java/ads/connection/ADSPlcConnection.java     | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git 
a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/connection/ADSPlcConnection.java
 
b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/connection/ADSPlcConnection.java
index 82be0de..40d7a0a 100644
--- 
a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/connection/ADSPlcConnection.java
+++ 
b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/connection/ADSPlcConnection.java
@@ -36,7 +36,6 @@ import org.apache.plc4x.java.api.model.Address;
 
 import java.net.InetAddress;
 import java.net.UnknownHostException;
-import java.util.Optional;
 import java.util.concurrent.CompletableFuture;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -47,7 +46,7 @@ public class ADSPlcConnection extends AbstractPlcConnection 
implements PlcReader
 
     private final String hostName;
 
-    private final Optional<Integer> suppliedPort;
+    private final Integer suppliedPort;
 
     private final AMSNetId targetAmsNetId;
 
@@ -75,7 +74,7 @@ public class ADSPlcConnection extends AbstractPlcConnection 
implements PlcReader
 
     public ADSPlcConnection(String hostName, Integer port, AMSNetId 
targetAmsNetId, AMSPort targetAmsPort, AMSNetId sourceAmsNetId, AMSPort 
sourceAmsPort) {
         this.hostName = hostName;
-        this.suppliedPort = Optional.ofNullable(port);
+        this.suppliedPort = port;
         this.targetAmsNetId = targetAmsNetId;
         this.targetAmsPort = targetAmsPort;
         this.sourceAmsNetId = sourceAmsNetId;
@@ -123,7 +122,7 @@ public class ADSPlcConnection extends AbstractPlcConnection 
implements PlcReader
                 }
             });
             // Start the client.
-            ChannelFuture f = bootstrap.connect(serverInetAddress, 
suppliedPort.orElse(TCP_PORT)).sync();
+            ChannelFuture f = bootstrap.connect(serverInetAddress, 
suppliedPort != null ? suppliedPort : TCP_PORT).sync();
             f.awaitUninterruptibly();
             // Wait till the session is finished initializing.
             channel = f.channel();

-- 
To stop receiving notification emails like this one, please contact
sru...@apache.org.

Reply via email to