You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by jm...@apache.org on 2018/02/19 23:57:52 UTC

[incubator-plc4x] 01/02: remove sonarqube issue

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

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

commit 3b0168debcecbbd89183427218debbfb956740e0
Author: Justin Mclean <jm...@apache.org>
AuthorDate: Tue Feb 20 10:55:38 2018 +1100

    remove sonarqube issue
---
 .../org/apache/plc4x/edgent/PlcConnectionAdapter.java | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git 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
index 4403aba..eedfc79 100644
--- 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
@@ -65,11 +65,12 @@ import com.google.gson.JsonObject;
 public class PlcConnectionAdapter implements AutoCloseable {
 
     private static final Logger logger = LoggerFactory.getLogger(PlcConnectionAdapter.class);
-
+    private static final Class[] allowedDataTypes = new Class[]{Boolean.class, Byte.class, Short.class, Integer.class, Float.class,  String.class, Calendar.class};
+    
     private String plcConnectionUrl;
     private PlcConnection plcConnection;
-  
-  /*
+
+    /*
    * NOTES:
    * - if we get to the point of the application needing some feedback (possibly control)
    *   of read or write errors, my thinking is to enhance the PlcConnectionAdapter
@@ -202,14 +203,10 @@ public class PlcConnectionAdapter implements AutoCloseable {
     }
 
     static void checkDatatype(Class<?> cls) {
-        if (cls == Boolean.class
-            || cls == Byte.class
-            || cls == Short.class
-            || cls == Integer.class
-            || cls == Float.class
-            || cls == String.class
-            || cls == Calendar.class)
-            return;
+        for (Class check: allowedDataTypes) {
+            if (check == cls)
+                return;
+        }
         throw new IllegalArgumentException("Not a legal plc data type: " + cls.getSimpleName());
     }
 

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