Service Handler optimizations and technical debt
[transportpce.git] / servicehandler / src / main / java / org / opendaylight / transportpce / servicehandler / validation / checks / ServicehandlerTxRxCheck.java
index cdcedfeda2b0cdea9dd67ab861363500eb8a3adf..fbca473aff2a63f1cac8913bd778bbb4b7d0cb92 100644 (file)
@@ -86,21 +86,20 @@ public final class ServicehandlerTxRxCheck {
     //sonar issue Reduce the number of conditional operators (4) used in the expression (maximum allowed 3)
     //won't be fixed because of functional checks needed
     public static boolean checkPort(Port port) {
-        boolean result = false;
-        if (port != null) {
-            String portDeviceName = port.getPortDeviceName();
-            String portType = port.getPortType();
-            String portName = port.getPortName();
-            String portRack = port.getPortRack();
-            String portShelf = port.getPortShelf();
-
-            return checkString(portDeviceName)
-                    && checkString(portType)
-                    && checkString(portName)
-                    && checkString(portRack)
-                    && checkString(portShelf);
-        }
-        return result;
+        if (port == null) {
+            return false;
+        }
+        String portDeviceName = port.getPortDeviceName();
+        String portType = port.getPortType();
+        String portName = port.getPortName();
+        String portRack = port.getPortRack();
+        String portShelf = port.getPortShelf();
+
+        return checkString(portDeviceName)
+                && checkString(portType)
+                && checkString(portName)
+                && checkString(portRack)
+                && checkString(portShelf);
     }
 
     /**
@@ -111,18 +110,17 @@ public final class ServicehandlerTxRxCheck {
      * @return true if String ok false if not
      */
     public static boolean checkLgx(Lgx lgx) {
-        boolean result = false;
-        if (lgx != null) {
-            String lgxDeviceName = lgx.getLgxDeviceName();
-            String lgxPortName = lgx.getLgxPortName();
-            String lgxPortRack = lgx.getLgxPortRack();
-            String lgxPortShelf = lgx.getLgxPortShelf();
-            if (checkString(lgxDeviceName) && checkString(lgxPortName) && checkString(lgxPortRack)
-                    && checkString(lgxPortShelf)) {
-                result = true;
-            }
-        }
-        return result;
+        if (lgx == null) {
+            return false;
+        }
+        String lgxDeviceName = lgx.getLgxDeviceName();
+        String lgxPortName = lgx.getLgxPortName();
+        String lgxPortRack = lgx.getLgxPortRack();
+        String lgxPortShelf = lgx.getLgxPortShelf();
+        return checkString(lgxDeviceName)
+                && checkString(lgxPortName)
+                && checkString(lgxPortRack)
+                && checkString(lgxPortShelf);
     }
 
     /**