Remove ByteBufUtil.macAddressToString() 12/92712/5
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 25 Sep 2020 10:19:00 +0000 (12:19 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 5 Oct 2020 09:38:41 +0000 (11:38 +0200)
All users have been migrated, remove this method along with its
test.

Change-Id: Ic8f213320a3df34f2a28c456ac686a4b47e61901
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
openflowjava/openflowjava-util/src/main/java/org/opendaylight/openflowjava/util/ByteBufUtils.java
openflowjava/openflowjava-util/src/test/java/org/opendaylight/openflowjava/util/ByteBufUtilsTest.java

index a86151e12fd509fda98f43693cb6587727b1dfe9..f67039565023a31618c569bb8a617a76b24f956e 100644 (file)
@@ -7,10 +7,8 @@
  */
 package org.opendaylight.openflowjava.util;
 
-import com.google.common.base.Preconditions;
 import com.google.common.base.Splitter;
 import com.google.common.collect.Lists;
-import com.google.common.primitives.UnsignedBytes;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.UnpooledByteBufAllocator;
 import java.nio.ByteBuffer;
@@ -220,12 +218,6 @@ public abstract class ByteBufUtils {
         return sb.toString().trim();
     }
 
-    private static void appendHexByte(final StringBuilder sb, final byte value) {
-        final int v = UnsignedBytes.toInt(value);
-        sb.append(HEX_CHARS[v >>> 4]);
-        sb.append(HEX_CHARS[v &  15]);
-    }
-
     private static void appendHexUnsignedShort(final StringBuilder sb, final int val) {
         sb.append(ByteBufUtils.HEX_CHARS[val >>> 12 & 15]);
         sb.append(ByteBufUtils.HEX_CHARS[val >>>  8 & 15]);
@@ -233,29 +225,6 @@ public abstract class ByteBufUtils {
         sb.append(ByteBufUtils.HEX_CHARS[val        & 15]);
     }
 
-    /**
-     * Converts a MAC address represented in bytes to String.
-     * See also {@link org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress}.
-     *
-     * @param address the MAC address to convert
-     * @return String representation of a MAC address
-     * @deprecated Use {@link IetfYangUtil#macAddressFor(byte[])} instead.
-     */
-    @Deprecated(forRemoval = true)
-    public static String macAddressToString(final byte[] address) {
-        Preconditions.checkArgument(address.length == EncodeConstants.MAC_ADDRESS_LENGTH);
-
-        final StringBuilder sb = new StringBuilder(17);
-
-        appendHexByte(sb, address[0]);
-        for (int i = 1; i < EncodeConstants.MAC_ADDRESS_LENGTH; i++) {
-            sb.append(':');
-            appendHexByte(sb, address[i]);
-        }
-
-        return sb.toString();
-    }
-
     /**
      * Reads and parses null-terminated string from ByteBuf.
      *
index 321ea1dbed3dacbcef6f74d66ac5429c78f9247d..e6221202100544b8a12ca92e0b5eec0b4b026cbe 100644 (file)
@@ -216,16 +216,6 @@ public class ByteBufUtilsTest {
         Assert.assertEquals("Strings does not match", expectedBinaryString, bitmaskValueInBinarySytring);
     }
 
-    /**
-     * Test of {@link ByteBufUtils#macAddressToString(byte[])}.
-     */
-    @Test(expected = IllegalArgumentException.class)
-    public void testMacToString() {
-        Assert.assertEquals("Wrong string decoded", "00:01:02:03:FF:05",
-                ByteBufUtils.macAddressToString(new byte[]{0, 1, 2, 3, (byte) 255, 5}));
-        ByteBufUtils.macAddressToString(new byte[]{0, 1, 2, 3, (byte) 255, 5, 6});
-    }
-
     /**
      * Test of {@link ByteBufUtils#decodeNullTerminatedString(ByteBuf, int)}.
      */