Remove Ipv{4,6}Address-based splitToParts() methods 36/80536/2
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 22 Feb 2019 11:01:28 +0000 (12:01 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 7 Mar 2019 10:40:24 +0000 (11:40 +0100)
These methods are marked as abuse, are inefficient and are actually
not used anywhere. Remove them.

JIRA: OPNFLWPLUG-1067
Change-Id: I58a75c96fa057faafadc27b459ae2412c7ae3f1d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/common/IpConversionUtil.java

index dafb038c69311feba8252435abcfb15c0a9eb862..af4849ed1b40eb00cbb889aaba25fac6a57e7886 100644 (file)
@@ -5,13 +5,11 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common;
 
 import com.google.common.base.Preconditions;
 import com.google.common.base.Splitter;
 import com.google.common.base.Strings;
-import com.google.common.collect.Iterators;
 import com.google.common.collect.Lists;
 import com.google.common.net.InetAddresses;
 import com.google.common.primitives.UnsignedBytes;
@@ -79,20 +77,10 @@ public final class IpConversionUtil {
         return PREFIX_SPLITTER.split(ipv4Prefix.getValue()).iterator();
     }
 
-    public static Iterator<String> splitToParts(final Ipv4Address ipv4Address) {
-        /* Invalid (Ab)use of ip address as prefix!!! */
-        return Iterators.forArray(ipv4Address.getValue(), String.valueOf(IPV4_ADDRESS_LENGTH));
-    }
-
     public static Iterator<String> splitToParts(final Ipv6Prefix ipv6Prefix) {
         return PREFIX_SPLITTER.split(ipv6Prefix.getValue()).iterator();
     }
 
-    public static Iterator<String> splitToParts(final Ipv6Address ipv6Address) {
-        /* Invalid (Ab)use of ip address as prefix!!! */
-        return Iterators.forArray(ipv6Address.getValue(), String.valueOf(IPV6_ADDRESS_LENGTH));
-    }
-
     /* This forest of functions has a purpose:
      *
      * 1. There are multiple coding styles around the plugin, this is necessary in order to have
@@ -693,7 +681,7 @@ public final class IpConversionUtil {
 
     @Nullable
     @SuppressFBWarnings("PZLA_PREFER_ZERO_LENGTH_ARRAYS")
-    public static byte[] convertArbitraryMaskToByteArray(DottedQuad mask) {
+    public static byte[] convertArbitraryMaskToByteArray(final DottedQuad mask) {
         String maskValue;
         if (mask != null && mask.getValue() != null) {
             maskValue  = mask.getValue();
@@ -711,7 +699,7 @@ public final class IpConversionUtil {
         return bytes;
     }
 
-    public static boolean isArbitraryBitMask(byte[] byteMask) {
+    public static boolean isArbitraryBitMask(final byte[] byteMask) {
         if (byteMask == null) {
             return false;
         } else {
@@ -727,7 +715,7 @@ public final class IpConversionUtil {
         }
     }
 
-    private static boolean checkArbitraryBitMask(ArrayList<Integer> arrayList) {
+    private static boolean checkArbitraryBitMask(final ArrayList<Integer> arrayList) {
         // checks 0*1* case - Leading zeros in arrayList are truncated
         if (arrayList.size() > 0 && arrayList.size() < IPV4_ADDRESS_LENGTH) {
             return true;