Do not use string concat in precondition 45/35445/1
authorRobert Varga <robert.varga@pantheon.sk>
Thu, 25 Feb 2016 19:47:31 +0000 (20:47 +0100)
committerMilos Fabian <milfabia@cisco.com>
Fri, 26 Feb 2016 08:12:41 +0000 (08:12 +0000)
Change-Id: Id25e4baab39ba13ad71748f4835732357fc11104
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
(cherry picked from commit f5b6727ce04f1f3224076ed316ebd19064a84b97)

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

index c6eabf53637f95f4e57fea567247d571f20298cb..0b723ed56cca7bfc8d4f3a39df28d8dd5485b84f 100644 (file)
@@ -157,7 +157,7 @@ public final class Ipv4Util {
     public static Ipv4Prefix prefixForByteBuf(final ByteBuf bytes) {
         final int prefixLength = bytes.readByte();
         final int size = prefixLength / Byte.SIZE + ((prefixLength % Byte.SIZE == 0) ? 0 : 1);
-        Preconditions.checkArgument(size <= bytes.readableBytes(), "Illegal length of IP prefix: " + (bytes.readableBytes()));
+        Preconditions.checkArgument(size <= bytes.readableBytes(), "Illegal length of IP prefix: %s", bytes.readableBytes());
         return Ipv4Util.prefixForBytes(ByteArray.readBytes(bytes, size), prefixLength);
     }
 
index cdff9665f81c101f97af911ca2008a72fbbf110e..84a061665f4171f3bee569ba3844ce06b7f93b70 100644 (file)
@@ -149,7 +149,7 @@ public final class Ipv6Util {
     public static Ipv6Prefix prefixForByteBuf(final ByteBuf bytes) {
         final int prefixLength = bytes.readByte();
         final int size = prefixLength / Byte.SIZE + ((prefixLength % Byte.SIZE == 0) ? 0 : 1);
-        Preconditions.checkArgument(size <= bytes.readableBytes(), "Illegal length of IP prefix: " + (bytes.readableBytes()));
+        Preconditions.checkArgument(size <= bytes.readableBytes(), "Illegal length of IP prefix: %s", bytes.readableBytes());
         return Ipv6Util.prefixForBytes(ByteArray.readBytes(bytes, size), prefixLength);
     }