Do not instantiate byte[] needlessly 41/35941/1
authorRobert Varga <rovarga@cisco.com>
Wed, 24 Feb 2016 19:32:46 +0000 (20:32 +0100)
committerRobert Varga <nite@hq.sk>
Tue, 8 Mar 2016 15:40:46 +0000 (15:40 +0000)
Creating a single-byte array is not needed here.

Change-Id: I518419438d6eae6146616fba0725245fc348fee7
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 51ea1ad17e3fd9b7ffe943cfe5f4e3bd71a892c8)

util/src/main/java/org/opendaylight/protocol/util/Ipv4Util.java
util/src/main/java/org/opendaylight/protocol/util/Ipv6Util.java

index c44db4d4f17f486594159a56e81e601aea2cb969..be7a7e668bdbe9a2ed80214d94b8ec5de5f4bf9c 100644 (file)
@@ -174,7 +174,7 @@ public final class Ipv4Util {
         final List<Ipv4Prefix> list = new ArrayList<>();
         int byteOffset = 0;
         while (byteOffset < bytes.length) {
-            final int bitLength = UnsignedBytes.toInt(ByteArray.subByte(bytes, byteOffset, 1)[0]);
+            final int bitLength = UnsignedBytes.toInt(bytes[byteOffset]);
             byteOffset += 1;
             // if length == 0, default route will be added
             if (bitLength == 0) {
index f041e1b54406058c0df7aa2c0d4ea95591d1c17a..c762c50ea0acaab37cbd0922f6ddfc215c7fb27f 100644 (file)
@@ -167,7 +167,7 @@ public final class Ipv6Util {
         final List<Ipv6Prefix> list = new ArrayList<>();
         int byteOffset = 0;
         while (byteOffset < bytes.length) {
-            final int bitLength = UnsignedBytes.toInt(ByteArray.subByte(bytes, byteOffset, 1)[0]);
+            final int bitLength = UnsignedBytes.toInt(bytes[byteOffset]);
             byteOffset += 1;
             // if length == 0, default route will be added
             if (bitLength == 0) {