More NetconfCommandUtils cleanup 23/109023/2
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 18 Nov 2023 07:52:34 +0000 (08:52 +0100)
committerRobert Varga <nite@hq.sk>
Sat, 18 Nov 2023 13:09:36 +0000 (13:09 +0000)
We have forgotten a commented-out block of code. Eliminate it and
simplify isIpValid().

Change-Id: I051d1114f142f92a91eb429ff036f5985476b046
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
apps/netconf-console/src/main/java/org/opendaylight/netconf/console/commands/NetconfCommandUtils.java

index f11658e94cee4e54827a896ddc06e2b0b998097d..939b8e9946f2f26ac39f0026b73da0861539dfd5 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.netconf.console.commands;
 
-import com.google.common.base.Strings;
 import java.util.regex.Pattern;
 
 final class NetconfCommandUtils {
@@ -21,9 +20,6 @@ final class NetconfCommandUtils {
     }
 
     static boolean isPortValid(final String devicePort) {
-//        if (Strings.isNullOrEmpty(devicePort)) {
-//            return false;
-//        }
         final int port;
         try {
             port = Integer.parseInt(devicePort);
@@ -34,9 +30,6 @@ final class NetconfCommandUtils {
     }
 
     static boolean isIpValid(final String deviceIp) {
-        if (Strings.isNullOrEmpty(deviceIp)) {
-            return false;
-        }
-        return IP_PATTERN.matcher(deviceIp).matches();
+        return deviceIp != null && IP_PATTERN.matcher(deviceIp).matches();
     }
 }