Checkstyle: fix issues and enforce on lisp-proto
[lispflowmapping.git] / mappingservice / lisp-proto / src / main / java / org / opendaylight / lispflowmapping / lisp / util / MaskUtil.java
index 207cb96b8d1da1f00c6d86e617f0807898c420d9..6fa17c40c69efe76190e3540aa97970c3f535ffb 100644 (file)
@@ -63,7 +63,7 @@ public final class MaskUtil {
         return false;
     }
 
-    private static final int slashPosition(final String prefix) {
+    private static int slashPosition(final String prefix) {
         final int slash = prefix.lastIndexOf('/');
         Preconditions.checkArgument(slash >= 0, "Argument %s does not contain a slash", prefix);
         return slash;
@@ -181,13 +181,13 @@ public final class MaskUtil {
 
     private static byte[] normalizeByteArray(byte[] address, short maskLength) {
         ByteBuffer byteRepresentation = ByteBuffer.wrap(address);
-        byte b = (byte) 0xff;
+        byte byteMask = (byte) 0xff;
         int mask = maskLength;
         for (int i = 0; i < byteRepresentation.array().length; i++) {
             if (mask >= 8) {
-                byteRepresentation.put(i, (byte) (b & byteRepresentation.get(i)));
+                byteRepresentation.put(i, (byte) (byteMask & byteRepresentation.get(i)));
             } else if (mask > 0) {
-                byteRepresentation.put(i, (byte) ((byte) (b << (8 - mask)) & byteRepresentation.get(i)));
+                byteRepresentation.put(i, (byte) ((byte) (byteMask << (8 - mask)) & byteRepresentation.get(i)));
             } else {
                 byteRepresentation.put(i, (byte) (0 & byteRepresentation.get(i)));
             }
@@ -209,13 +209,6 @@ public final class MaskUtil {
         }
     }
 
-    public static short getMaskForAddress(SimpleAddress address) {
-        if (address.getIpPrefix() == null) {
-            return -1;
-        }
-        return getMaskForIpPrefix(address.getIpPrefix());
-    }
-
     private static String getIpPrefixString(IpPrefix prefix) {
         if (prefix.getIpv4Prefix() != null) {
             return prefix.getIpv4Prefix().getValue();
@@ -242,6 +235,13 @@ public final class MaskUtil {
         return getPrefixAddress(prefix.getIpv6Prefix().getValue());
     }
 
+    public static short getMaskForAddress(SimpleAddress address) {
+        if (address.getIpPrefix() == null) {
+            return -1;
+        }
+        return getMaskForIpPrefix(address.getIpPrefix());
+    }
+
     public static short getMaskForAddress(Address address) {
         if (address instanceof Ipv4) {
             return IPV4_MAX_MASK;