Do not use string concat in precondition 19/35419/2
authorRobert Varga <robert.varga@pantheon.sk>
Thu, 25 Feb 2016 19:47:31 +0000 (20:47 +0100)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 26 Feb 2016 08:12:32 +0000 (08:12 +0000)
Change-Id: Id25e4baab39ba13ad71748f4835732357fc11104
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
util/src/main/java/org/opendaylight/protocol/util/Ipv4Util.java
util/src/main/java/org/opendaylight/protocol/util/Ipv6Util.java

index e4406dc5668a5b586cfc1d05edd334e7d840f0d5..05e6abc0f468cc7b79052f76b3eb4ae0c7541ee3 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 1f7837fa8beacdb1c2a661296496ef639f547757..514143136aca0674781dae1f3d13ef7ab7d4ea76 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);
     }