From 213019300c39dec33155b63ad5374842f92760ac Mon Sep 17 00:00:00 2001 From: Gary Wu Date: Mon, 4 Jan 2016 11:48:18 -0800 Subject: [PATCH] Remove unnecessary casts Change-Id: Ib20f8d15529293ee9037c7213ed5eb388ba532ac Signed-off-by: Gary Wu --- .../controller/liblldp/BitBufferHelper.java | 10 +++++----- .../opendaylight/controller/liblldp/EtherTypes.java | 4 ++-- .../controller/sal/packet/BitBufferHelperTest.java | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/BitBufferHelper.java b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/BitBufferHelper.java index fc515e109d..c1d2beff3e 100644 --- a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/BitBufferHelper.java +++ b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/BitBufferHelper.java @@ -103,7 +103,7 @@ public abstract class BitBufferHelper { logger.error("", e); } } - return (long) toNumber(data); + return toNumber(data); } /** @@ -189,7 +189,7 @@ public abstract class BitBufferHelper { } catch (BufferException e) { logger.error("", e); } - return (long) toNumber(bits, numBits); + return toNumber(bits, numBits); } /** @@ -238,7 +238,7 @@ public abstract class BitBufferHelper { return bytes; } else { System.arraycopy(data, startByteOffset, bytes, 0, numBytes - 1); - bytes[numBytes - 1] = (byte) ((int) data[startByteOffset + bytes[numBytes - 1] = (byte) (data[startByteOffset + numBytes - 1] & getMSBMask(extranumBits)); } } else { @@ -363,7 +363,7 @@ public abstract class BitBufferHelper { value += 256; } ret = ret - | (long) ((long) value << ((length - i - 1) * NetUtils.NumBitsInAByte)); + | (long) value << ((length - i - 1) * NetUtils.NumBitsInAByte); } return ret; } @@ -395,7 +395,7 @@ public abstract class BitBufferHelper { value += 256; } ret = ret - | (long) ((long) value << ((array.length - i - 1) * NetUtils.NumBitsInAByte)); + | (long) value << ((array.length - i - 1) * NetUtils.NumBitsInAByte); } return ret; diff --git a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/EtherTypes.java b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/EtherTypes.java index 566e5516ea..e3c46fbf6a 100644 --- a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/EtherTypes.java +++ b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/EtherTypes.java @@ -54,11 +54,11 @@ public enum EtherTypes { } public static String getEtherTypeName(short number) { - return getEtherTypeInternal((int) number & 0xffff); + return getEtherTypeInternal(number & 0xffff); } public static String getEtherTypeName(byte number) { - return getEtherTypeInternal((int) number & 0xff); + return getEtherTypeInternal(number & 0xff); } private static String getEtherTypeInternal(int number) { diff --git a/opendaylight/commons/liblldp/src/test/java/org/opendaylight/controller/sal/packet/BitBufferHelperTest.java b/opendaylight/commons/liblldp/src/test/java/org/opendaylight/controller/sal/packet/BitBufferHelperTest.java index 32e873bf1e..0ba5476e52 100644 --- a/opendaylight/commons/liblldp/src/test/java/org/opendaylight/controller/sal/packet/BitBufferHelperTest.java +++ b/opendaylight/commons/liblldp/src/test/java/org/opendaylight/controller/sal/packet/BitBufferHelperTest.java @@ -295,7 +295,7 @@ public class BitBufferHelperTest { Assert.assertTrue(data_sh[0] == (byte) 255); Assert.assertTrue(data_sh[1] == (byte) 128); - data_sh = BitBufferHelper.toByteArray((int) 511, len); + data_sh = BitBufferHelper.toByteArray(511, len); Assert.assertTrue(data_sh[0] == (byte) 255); Assert.assertTrue(data_sh[1] == (byte) 128); -- 2.36.6