From af14e8a5cc7d3654785ffb8cf192eaeea8ba2fae Mon Sep 17 00:00:00 2001 From: Stephen Kitt Date: Thu, 11 May 2017 18:54:05 +0200 Subject: [PATCH] liblldp: final parameters This automatically-generated patch flags all appropriate parameters as final (including caught exceptions). Change-Id: If4e0f5e379b1c4f00970e862a775db372cc191fe Signed-off-by: Stephen Kitt --- .../controller/liblldp/BitBufferHelper.java | 68 +++++++++---------- .../controller/liblldp/BufferException.java | 2 +- .../liblldp/ConstructionException.java | 2 +- .../controller/liblldp/CustomTLVKey.java | 4 +- .../controller/liblldp/DataLinkAddress.java | 4 +- .../controller/liblldp/EtherTypes.java | 16 ++--- .../controller/liblldp/Ethernet.java | 10 +-- .../controller/liblldp/EthernetAddress.java | 10 +-- .../controller/liblldp/HexEncode.java | 10 +-- .../opendaylight/controller/liblldp/LLDP.java | 28 ++++---- .../controller/liblldp/LLDPTLV.java | 34 +++++----- .../controller/liblldp/NetUtils.java | 58 ++++++++-------- .../controller/liblldp/Packet.java | 24 +++---- .../controller/liblldp/PacketException.java | 2 +- .../controller/liblldp/LLDPTest.java | 12 ++-- .../packet/address/EthernetAddressTest.java | 14 ++-- 16 files changed, 149 insertions(+), 149 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 fd0659990e..c2fa6c38d0 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 @@ -39,12 +39,12 @@ public abstract class BitBufferHelper { * Returns the first byte from the byte array * @return byte value */ - public static byte getByte(byte[] data) { + public static byte getByte(final byte[] data) { if ((data.length * NetUtils.NumBitsInAByte) > Byte.SIZE) { try { throw new BufferException( "Container is too small for the number of requested bits"); - } catch (BufferException e) { + } catch (final BufferException e) { logger.error("", e); } } @@ -56,12 +56,12 @@ public abstract class BitBufferHelper { * Size of byte array is restricted to Short.SIZE * @return short value */ - public static short getShort(byte[] data) { + public static short getShort(final byte[] data) { if (data.length > Short.SIZE) { try { throw new BufferException( "Container is too small for the number of requested bits"); - } catch (BufferException e) { + } catch (final BufferException e) { logger.error("", e); } } @@ -73,12 +73,12 @@ public abstract class BitBufferHelper { * Size of byte array is restricted to Integer.SIZE * @return int - the integer value of byte array */ - public static int getInt(byte[] data) { + public static int getInt(final byte[] data) { if (data.length > Integer.SIZE) { try { throw new BufferException( "Container is too small for the number of requested bits"); - } catch (BufferException e) { + } catch (final BufferException e) { logger.error("", e); } } @@ -90,12 +90,12 @@ public abstract class BitBufferHelper { * Size of byte array is restricted to Long.SIZE * @return long - the integer value of byte array */ - public static long getLong(byte[] data) { + public static long getLong(final byte[] data) { if (data.length > Long.SIZE) { try { throw new BufferException( "Container is too small for the number of requested bits"); - } catch (Exception e) { + } catch (final Exception e) { logger.error("", e); } } @@ -107,12 +107,12 @@ public abstract class BitBufferHelper { * Size of numBits is restricted to Short.SIZE * @return short - the short value of byte array */ - public static short getShort(byte[] data, int numBits) { + public static short getShort(final byte[] data, final int numBits) { if (numBits > Short.SIZE) { try { throw new BufferException( "Container is too small for the number of requested bits"); - } catch (BufferException e) { + } catch (final BufferException e) { logger.error("", e); } } @@ -120,7 +120,7 @@ public abstract class BitBufferHelper { byte[] bits = null; try { bits = BitBufferHelper.getBits(data, startOffset, numBits); - } catch (BufferException e) { + } catch (final BufferException e) { logger.error("", e); } return (short) toNumber(bits, numBits); @@ -131,12 +131,12 @@ public abstract class BitBufferHelper { * Size of numBits is restricted to Integer.SIZE * @return int - the integer value of byte array */ - public static int getInt(byte[] data, int numBits) { + public static int getInt(final byte[] data, final int numBits) { if (numBits > Integer.SIZE) { try { throw new BufferException( "Container is too small for the number of requested bits"); - } catch (BufferException e) { + } catch (final BufferException e) { logger.error("", e); } } @@ -144,7 +144,7 @@ public abstract class BitBufferHelper { byte[] bits = null; try { bits = BitBufferHelper.getBits(data, startOffset, numBits); - } catch (BufferException e) { + } catch (final BufferException e) { logger.error("", e); } return (int) toNumber(bits, numBits); @@ -155,12 +155,12 @@ public abstract class BitBufferHelper { * Size of numBits is restricted to Long.SIZE * @return long - the integer value of byte array */ - public static long getLong(byte[] data, int numBits) { + public static long getLong(final byte[] data, final int numBits) { if (numBits > Long.SIZE) { try { throw new BufferException( "Container is too small for the number of requested bits"); - } catch (BufferException e) { + } catch (final BufferException e) { logger.error("", e); } } @@ -168,7 +168,7 @@ public abstract class BitBufferHelper { try { throw new BufferException( "Trying to read more bits than contained in the data buffer"); - } catch (BufferException e) { + } catch (final BufferException e) { logger.error("", e); } } @@ -176,7 +176,7 @@ public abstract class BitBufferHelper { byte[] bits = null; try { bits = BitBufferHelper.getBits(data, startOffset, numBits); - } catch (BufferException e) { + } catch (final BufferException e) { logger.error("", e); } return toNumber(bits, numBits); @@ -203,7 +203,7 @@ public abstract class BitBufferHelper { * when the startOffset and numBits parameters are not congruent * with the data buffer size */ - public static byte[] getBits(byte[] data, int startOffset, int numBits) + public static byte[] getBits(final byte[] data, final int startOffset, final int numBits) throws BufferException { int startByteOffset = 0; @@ -284,8 +284,8 @@ public abstract class BitBufferHelper { * when the input, startOffset and numBits are not congruent * with the data buffer size */ - public static void setByte(byte[] data, byte input, int startOffset, - int numBits) throws BufferException { + public static void setByte(final byte[] data, final byte input, final int startOffset, + final int numBits) throws BufferException { byte[] inputByteArray = new byte[1]; Arrays.fill(inputByteArray, 0, 1, input); setBytes(data, inputByteArray, startOffset, numBits); @@ -301,8 +301,8 @@ public abstract class BitBufferHelper { * when the startOffset and numBits parameters are not congruent * with data and input buffers' size */ - public static void setBytes(byte[] data, byte[] input, int startOffset, - int numBits) throws BufferException { + public static void setBytes(final byte[] data, final byte[] input, final int startOffset, + final int numBits) throws BufferException { checkExceptions(data, startOffset, numBits); insertBits(data, input, startOffset, numBits); } @@ -310,7 +310,7 @@ public abstract class BitBufferHelper { /** * Returns numBits 1's in the MSB position */ - public static int getMSBMask(int numBits) { + public static int getMSBMask(final int numBits) { int mask = 0; for (int i = 0; i < numBits; i++) { mask = mask | (1 << (7 - i)); @@ -321,7 +321,7 @@ public abstract class BitBufferHelper { /** * Returns numBits 1's in the LSB position */ - public static int getLSBMask(int numBits) { + public static int getLSBMask(final int numBits) { int mask = 0; for (int i = 0; i < numBits; i++) { mask = mask | (1 << i); @@ -334,7 +334,7 @@ public abstract class BitBufferHelper { * * @return long - numerical value of byte array passed */ - static public long toNumber(byte[] array) { + static public long toNumber(final byte[] array) { long ret = 0; long length = array.length; int value = 0; @@ -355,7 +355,7 @@ public abstract class BitBufferHelper { * * @return long - numerical value of byte array passed */ - static public long toNumber(byte[] array, int numBits) { + static public long toNumber(final byte[] array, final int numBits) { int length = numBits / NetUtils.NumBitsInAByte; int bitsRest = numBits % NetUtils.NumBitsInAByte; int startOffset = array.length - length; @@ -385,7 +385,7 @@ public abstract class BitBufferHelper { * aligned form example: input = 5000 [1001110001000] bytes = 19, -120 * [00010011] [10001000] */ - public static byte[] toByteArray(Number input) { + public static byte[] toByteArray(final Number input) { Class dataType = input.getClass(); short size = 0; long longValue = input.longValue(); @@ -423,7 +423,7 @@ public abstract class BitBufferHelper { * @return byte[] * */ - public static byte[] toByteArray(Number input, int numBits) { + public static byte[] toByteArray(final Number input, final int numBits) { Class dataType = input.getClass(); short size = 0; long longValue = input.longValue(); @@ -483,7 +483,7 @@ public abstract class BitBufferHelper { * @param numBits - number of bits to be left aligned * @return byte[] */ - public static byte[] shiftBitsToMSB(byte[] inputBytes, int numBits) { + public static byte[] shiftBitsToMSB(final byte[] inputBytes, final int numBits) { int numBitstoShiftBy = 0, leadZeroesMSB = 8, numEndRestBits = 0; int size = inputBytes.length; byte[] shiftedBytes = new byte[size]; @@ -541,7 +541,7 @@ public abstract class BitBufferHelper { * @param numBits - number of bits to be right aligned * @return byte[] */ - public static byte[] shiftBitsToLSB(byte[] inputBytes, int numBits) { + public static byte[] shiftBitsToLSB(final byte[] inputBytes, final int numBits) { int numBytes = inputBytes.length; int numBitstoShift = numBits % NetUtils.NumBitsInAByte; byte[] shiftedBytes = new byte[numBytes]; @@ -571,8 +571,8 @@ public abstract class BitBufferHelper { * of bits specified from the input data byte array. The input byte array * has the bits stored starting from the LSB */ - public static void insertBits(byte[] data, byte[] inputdataLSB, - int startOffset, int numBits) { + public static void insertBits(final byte[] data, final byte[] inputdataLSB, + final int startOffset, final int numBits) { byte[] inputdata = shiftBitsToMSB(inputdataLSB, numBits); // Align to // MSB the // passed byte @@ -654,7 +654,7 @@ public abstract class BitBufferHelper { * @throws BufferException when the startOffset and numBits parameters * are not congruent with the data buffer's size */ - public static void checkExceptions(byte[] data, int startOffset, int numBits) + public static void checkExceptions(final byte[] data, final int startOffset, final int numBits) throws BufferException { int endOffsetByte; int startByteOffset; diff --git a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/BufferException.java b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/BufferException.java index fa0848d894..f584a23790 100644 --- a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/BufferException.java +++ b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/BufferException.java @@ -13,7 +13,7 @@ package org.opendaylight.controller.liblldp; public class BufferException extends Exception { private static final long serialVersionUID = 1L; - public BufferException(String message) { + public BufferException(final String message) { super(message); } } diff --git a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/ConstructionException.java b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/ConstructionException.java index e1bc30afb9..d5f854f4fa 100644 --- a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/ConstructionException.java +++ b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/ConstructionException.java @@ -21,7 +21,7 @@ package org.opendaylight.controller.liblldp; public class ConstructionException extends Exception { private static final long serialVersionUID = 1L; - public ConstructionException(String message) { + public ConstructionException(final String message) { super(message); } } diff --git a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/CustomTLVKey.java b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/CustomTLVKey.java index 9953c7e665..fd5c210063 100644 --- a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/CustomTLVKey.java +++ b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/CustomTLVKey.java @@ -17,7 +17,7 @@ public class CustomTLVKey { * @param oui * @param subtype */ - public CustomTLVKey(int oui, byte subtype) { + public CustomTLVKey(final int oui, final byte subtype) { this.oui = oui; this.subtype = subtype; } @@ -46,7 +46,7 @@ public class CustomTLVKey { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (this == obj) { return true; } diff --git a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/DataLinkAddress.java b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/DataLinkAddress.java index 2649489569..a9bc910ffc 100644 --- a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/DataLinkAddress.java +++ b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/DataLinkAddress.java @@ -38,7 +38,7 @@ abstract public class DataLinkAddress implements Serializable { * @param name Create a new DataLink, not for general use but * available only for sub classes */ - protected DataLinkAddress(String name) { + protected DataLinkAddress(final String name) { this.name = name; } @@ -70,7 +70,7 @@ abstract public class DataLinkAddress implements Serializable { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (this == obj) { return true; } 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 de5834faee..84f47da8a8 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 @@ -32,7 +32,7 @@ public enum EtherTypes { private String description; private int number; - EtherTypes(String description, int number) { + EtherTypes(final String description, final int number) { this.description = description; this.number = number; } @@ -49,19 +49,19 @@ public enum EtherTypes { return ((Integer) number).shortValue(); } - public static String getEtherTypeName(int number) { + public static String getEtherTypeName(final int number) { return getEtherTypeInternal(number); } - public static String getEtherTypeName(short number) { + public static String getEtherTypeName(final short number) { return getEtherTypeInternal(number & 0xffff); } - public static String getEtherTypeName(byte number) { + public static String getEtherTypeName(final byte number) { return getEtherTypeInternal(number & 0xff); } - private static String getEtherTypeInternal(int number) { + private static String getEtherTypeInternal(final int number) { for (EtherTypes type : EtherTypes.values()) { if (type.number == number) { return type.toString(); @@ -70,7 +70,7 @@ public enum EtherTypes { return "0x" + Integer.toHexString(number); } - public static short getEtherTypeNumberShort(String name) { + public static short getEtherTypeNumberShort(final String name) { if (name.matches(regexNumberString)) { return Short.valueOf(name); } @@ -82,7 +82,7 @@ public enum EtherTypes { return 0; } - public static int getEtherTypeNumberInt(String name) { + public static int getEtherTypeNumberInt(final String name) { if (name.matches(regexNumberString)) { return Integer.valueOf(name); } @@ -102,7 +102,7 @@ public enum EtherTypes { return ethertypesList; } - public static EtherTypes loadFromString(String string) { + public static EtherTypes loadFromString(final String string) { int intType = Integer.parseInt(string); for (EtherTypes type : EtherTypes.values()) { diff --git a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/Ethernet.java b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/Ethernet.java index 424bdd016a..2cdf9a5ae0 100644 --- a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/Ethernet.java +++ b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/Ethernet.java @@ -54,7 +54,7 @@ public class Ethernet extends Packet { * Constructor that sets the access level for the packet and * creates and sets the HashMap */ - public Ethernet(boolean writeAccess) { + public Ethernet(final boolean writeAccess) { super(writeAccess); fieldValues = new HashMap<>(); hdrFieldCoordMap = fieldCoordinates; @@ -62,7 +62,7 @@ public class Ethernet extends Packet { } @Override - public void setHeaderField(String headerField, byte[] readValue) { + public void setHeaderField(final String headerField, final byte[] readValue) { if (headerField.equals(ETHT)) { payloadClass = etherTypeClassMap.get(BitBufferHelper .getShort(readValue)); @@ -106,7 +106,7 @@ public class Ethernet extends Packet { * Sets the destination MAC address for the current Ethernet object instance * @param destinationMACAddress the destinationMACAddress to set */ - public Ethernet setDestinationMACAddress(byte[] destinationMACAddress) { + public Ethernet setDestinationMACAddress(final byte[] destinationMACAddress) { fieldValues.put(DMAC, destinationMACAddress); return this; } @@ -115,7 +115,7 @@ public class Ethernet extends Packet { * Sets the source MAC address for the current Ethernet object instance * @param sourceMACAddress the sourceMACAddress to set */ - public Ethernet setSourceMACAddress(byte[] sourceMACAddress) { + public Ethernet setSourceMACAddress(final byte[] sourceMACAddress) { fieldValues.put(SMAC, sourceMACAddress); return this; } @@ -124,7 +124,7 @@ public class Ethernet extends Packet { * Sets the etherType for the current Ethernet object instance * @param etherType the etherType to set */ - public Ethernet setEtherType(short etherType) { + public Ethernet setEtherType(final short etherType) { byte[] ethType = BitBufferHelper.toByteArray(etherType); fieldValues.put(ETHT, ethType); return this; diff --git a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/EthernetAddress.java b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/EthernetAddress.java index 947603c45b..fb75532e39 100644 --- a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/EthernetAddress.java +++ b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/EthernetAddress.java @@ -32,10 +32,10 @@ public class EthernetAddress extends DataLinkAddress { public static final String addressName = "Ethernet MAC Address"; public static final int SIZE = 6; - private static final EthernetAddress createWellKnownAddress(byte[] mac) { + private static final EthernetAddress createWellKnownAddress(final byte[] mac) { try { return new EthernetAddress(mac); - } catch (ConstructionException ce) { + } catch (final ConstructionException ce) { return null; } } @@ -53,7 +53,7 @@ public class EthernetAddress extends DataLinkAddress { * @param macAddress A byte array in big endian format * representing the Ethernet MAC Address */ - public EthernetAddress(byte[] macAddress) throws ConstructionException { + public EthernetAddress(final byte[] macAddress) throws ConstructionException { super(addressName); if (macAddress == null) { @@ -72,7 +72,7 @@ public class EthernetAddress extends DataLinkAddress { public EthernetAddress clone() { try { return new EthernetAddress(this.macAddress.clone()); - } catch (ConstructionException ce) { + } catch (final ConstructionException ce) { return null; } } @@ -95,7 +95,7 @@ public class EthernetAddress extends DataLinkAddress { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (this == obj) { return true; } diff --git a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/HexEncode.java b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/HexEncode.java index 43df7a5e82..cef174513b 100644 --- a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/HexEncode.java +++ b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/HexEncode.java @@ -24,7 +24,7 @@ public class HexEncode { * @return The hexadecimal representation of the byte array. If bytes is * null, "null" string is returned */ - public static String bytesToHexString(byte[] bytes) { + public static String bytesToHexString(final byte[] bytes) { if (bytes == null) { return "null"; @@ -47,7 +47,7 @@ public class HexEncode { return ret; } - public static String longToHexString(long val) { + public static String longToHexString(final long val) { char arr[] = Long.toHexString(val).toCharArray(); StringBuffer buf = new StringBuffer(); // prepend the right number of leading zeros @@ -68,7 +68,7 @@ public class HexEncode { } - public static byte[] bytesFromHexString(String values) { + public static byte[] bytesFromHexString(final String values) { String target = ""; if (values != null) { target = values; @@ -82,7 +82,7 @@ public class HexEncode { return ret; } - public static long stringToLong(String values) { + public static long stringToLong(final String values) { long value = new BigInteger(values.replaceAll(":", ""), 16).longValue(); return value; } @@ -90,7 +90,7 @@ public class HexEncode { /** * This method converts byte array into HexString format with ":" inserted. */ - public static String bytesToHexStringFormat(byte[] bytes) { + public static String bytesToHexStringFormat(final byte[] bytes) { if (bytes == null) { return "null"; } diff --git a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/LLDP.java b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/LLDP.java index bbee8599b6..1b76c99805 100644 --- a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/LLDP.java +++ b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/LLDP.java @@ -41,7 +41,7 @@ public class LLDP extends Packet { /** * Constructor that creates the tlvList LinkedHashMap and sets the write access for the same */ - public LLDP(boolean writeAccess) { + public LLDP(final boolean writeAccess) { super(writeAccess); init(); } @@ -57,7 +57,7 @@ public class LLDP extends Packet { * - description of the type of TLV * @return byte - type of TLV */ - private byte getType(String typeDesc) { + private byte getType(final String typeDesc) { if (typeDesc.equals(CHASSISID)) { return LLDPTLV.TLVType.ChassisID.getValue(); } else if (typeDesc.equals(PORTID)) { @@ -71,7 +71,7 @@ public class LLDP extends Packet { } } - private LLDPTLV getFromTLVs(Byte type) { + private LLDPTLV getFromTLVs(final Byte type) { LLDPTLV tlv = null; tlv = mandatoryTLVs.get(type); if (tlv == null) { @@ -94,11 +94,11 @@ public class LLDP extends Packet { * - description of the type of TLV * @return LLDPTLV - full TLV */ - public LLDPTLV getTLV(String type) { + public LLDPTLV getTLV(final String type) { return getFromTLVs(getType(type)); } - public LLDPTLV getCustomTLV(CustomTLVKey key) { + public LLDPTLV getCustomTLV(final CustomTLVKey key) { return customTLVs.get(key); } @@ -108,7 +108,7 @@ public class LLDP extends Packet { * @param tlv * - tlv to set */ - public void setTLV(String type, LLDPTLV tlv) { + public void setTLV(final String type, final LLDPTLV tlv) { putToTLVs(getType(type), tlv); } @@ -123,7 +123,7 @@ public class LLDP extends Packet { * @param chassisId * - the chassisId to set */ - public LLDP setChassisId(LLDPTLV chassisId) { + public LLDP setChassisId(final LLDPTLV chassisId) { setTLV(CHASSISID, chassisId); return this; } @@ -139,7 +139,7 @@ public class LLDP extends Packet { * @param systemNameId * - the systemNameId to set */ - public LLDP setSystemNameId(LLDPTLV systemNameId) { + public LLDP setSystemNameId(final LLDPTLV systemNameId) { setTLV(SYSTEMNAMEID, systemNameId); return this; } @@ -156,7 +156,7 @@ public class LLDP extends Packet { * - the portId to set * @return LLDP */ - public LLDP setPortId(LLDPTLV portId) { + public LLDP setPortId(final LLDPTLV portId) { setTLV(PORTID, portId); return this; } @@ -173,7 +173,7 @@ public class LLDP extends Packet { * - the ttl to set * @return LLDP */ - public LLDP setTtl(LLDPTLV ttl) { + public LLDP setTtl(final LLDPTLV ttl) { setTLV(TTL, ttl); return this; } @@ -197,7 +197,7 @@ public class LLDP extends Packet { * the optionalTLVList to set * @return LLDP */ - public LLDP setOptionalTLVList(List optionalTLVList) { + public LLDP setOptionalTLVList(final List optionalTLVList) { for (LLDPTLV tlv : optionalTLVList) { optionalTLVs.put(tlv.getType(), tlv); } @@ -218,7 +218,7 @@ public class LLDP extends Packet { } @Override - public Packet deserialize(byte[] data, int bitOffset, int size) throws PacketException { + public Packet deserialize(final byte[] data, final int bitOffset, final int size) throws PacketException { int lldpOffset = bitOffset; // LLDP start int lldpSize = size; // LLDP size @@ -257,7 +257,7 @@ public class LLDP extends Packet { int numBits = tlv.getTLVSize(); try { BitBufferHelper.setBytes(serializedBytes, tlv.serialize(), startOffset, numBits); - } catch (BufferException e) { + } catch (final BufferException e) { throw new PacketException(e.getMessage()); } startOffset += numBits; @@ -266,7 +266,7 @@ public class LLDP extends Packet { try { BitBufferHelper.setBytes(serializedBytes, LLDP.emptyTLV.serialize(), startOffset, LLDP.emptyTLV.getTLVSize()); - } catch (BufferException e) { + } catch (final BufferException e) { throw new PacketException(e.getMessage()); } diff --git a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/LLDPTLV.java b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/LLDPTLV.java index bc241928fb..24b350cdc6 100644 --- a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/LLDPTLV.java +++ b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/LLDPTLV.java @@ -57,7 +57,7 @@ public class LLDPTLV extends Packet { private byte value; - TLVType(byte value) { + TLVType(final byte value) { this.value = value; } @@ -92,7 +92,7 @@ public class LLDPTLV extends Packet { /** * Constructor that writes the passed LLDPTLV values to the hdrFieldsMap */ - public LLDPTLV(LLDPTLV other) { + public LLDPTLV(final LLDPTLV other) { for (Map.Entry entry : other.hdrFieldsMap.entrySet()) { this.hdrFieldsMap.put(entry.getKey(), entry.getValue()); } @@ -124,7 +124,7 @@ public class LLDPTLV extends Packet { * @param type the type to set * @return LLDPTLV */ - public LLDPTLV setType(byte type) { + public LLDPTLV setType(final byte type) { byte[] lldpTLVtype = { type }; fieldValues.put(TYPE, lldpTLVtype); return this; @@ -134,7 +134,7 @@ public class LLDPTLV extends Packet { * @param length the length to set * @return LLDPTLV */ - public LLDPTLV setLength(short length) { + public LLDPTLV setLength(final short length) { fieldValues.put(LENGTH, BitBufferHelper.toByteArray(length)); return this; } @@ -143,13 +143,13 @@ public class LLDPTLV extends Packet { * @param value the value to set * @return LLDPTLV */ - public LLDPTLV setValue(byte[] value) { + public LLDPTLV setValue(final byte[] value) { fieldValues.put(VALUE, value); return this; } @Override - public void setHeaderField(String headerField, byte[] readValue) { + public void setHeaderField(final String headerField, final byte[] readValue) { hdrFieldsMap.put(headerField, readValue); } @@ -163,7 +163,7 @@ public class LLDPTLV extends Packet { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (this == obj) { return true; } @@ -185,7 +185,7 @@ public class LLDPTLV extends Packet { } @Override - public int getfieldnumBits(String fieldName) { + public int getfieldnumBits(final String fieldName) { if (fieldName.equals(VALUE)) { return (NetUtils.NumBitsInAByte * BitBufferHelper.getShort( fieldValues.get(LENGTH), fieldCoordinates.get(LENGTH) @@ -212,7 +212,7 @@ public class LLDPTLV extends Packet { * node identifier string * @return the SystemName TLV value in byte array */ - static public byte[] createSystemNameTLVValue(String nodeId) { + static public byte[] createSystemNameTLVValue(final String nodeId) { byte[] nid = nodeId.getBytes(); return nid; } @@ -225,7 +225,7 @@ public class LLDPTLV extends Packet { * node identifier string * @return the ChassisID TLV value in byte array */ - static public byte[] createChassisIDTLVValue(String nodeId) { + static public byte[] createChassisIDTLVValue(final String nodeId) { byte[] nid = HexEncode.bytesFromHexString(nodeId); byte[] cid = new byte[6]; int srcPos = 0, dstPos = 0; @@ -253,7 +253,7 @@ public class LLDPTLV extends Packet { * port identifier string * @return the PortID TLV value in byte array */ - static public byte[] createPortIDTLVValue(String portId) { + static public byte[] createPortIDTLVValue(final String portId) { byte[] pid = portId.getBytes(Charset.defaultCharset()); byte[] pidValue = new byte[pid.length + portIDSubType.length]; @@ -271,7 +271,7 @@ public class LLDPTLV extends Packet { * @return the custom TLV value in byte array * @see #createCustomTLVValue(byte[],byte[]) */ - static public byte[] createCustomTLVValue(String customString) { + static public byte[] createCustomTLVValue(final String customString) { byte[] customByteArray = customString.getBytes(Charset.defaultCharset()); return createCustomTLVValue(CUSTOM_TLV_SUB_TYPE_NODE_CONNECTOR_ID, customByteArray); } @@ -283,7 +283,7 @@ public class LLDPTLV extends Packet { * port identifier string * @return the custom TLV value in byte array */ - static public byte[] createCustomTLVValue(byte[] subtype, byte[] customByteArray) { + static public byte[] createCustomTLVValue(final byte[] subtype, final byte[] customByteArray) { byte[] customValue = new byte[customTlvOffset + customByteArray.length]; System.arraycopy(OFOUI, 0, customValue, 0, OFOUI.length); @@ -303,7 +303,7 @@ public class LLDPTLV extends Packet { * the TLV length * @return the HexString */ - static public String getHexStringValue(byte[] tlvValue, int tlvLen) { + static public String getHexStringValue(final byte[] tlvValue, final int tlvLen) { byte[] cidBytes = new byte[tlvLen - chassisIDSubType.length]; System.arraycopy(tlvValue, chassisIDSubType.length, cidBytes, 0, cidBytes.length); @@ -319,7 +319,7 @@ public class LLDPTLV extends Packet { * the TLV length * @return the string */ - static public String getStringValue(byte[] tlvValue, int tlvLen) { + static public String getStringValue(final byte[] tlvValue, final int tlvLen) { byte[] pidSubType = new byte[portIDSubType.length]; byte[] pidBytes = new byte[tlvLen - portIDSubType.length]; System.arraycopy(tlvValue, 0, pidSubType, 0, @@ -343,7 +343,7 @@ public class LLDPTLV extends Packet { * the custom TLV length * @return the custom string */ - static public String getCustomString(byte[] customTlvValue, int customTlvLen) { + static public String getCustomString(final byte[] customTlvValue, final int customTlvLen) { String customString = ""; byte[] vendor = new byte[3]; System.arraycopy(customTlvValue, 0, vendor, 0, vendor.length); @@ -354,7 +354,7 @@ public class LLDPTLV extends Packet { customArrayLength); try { customString = new String(customArray, "UTF-8"); - } catch (UnsupportedEncodingException e) { + } catch (final UnsupportedEncodingException e) { } } diff --git a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/NetUtils.java b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/NetUtils.java index 08c7fb65aa..55466a6b1b 100644 --- a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/NetUtils.java +++ b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/NetUtils.java @@ -52,7 +52,7 @@ public abstract class NetUtils { * the 4 bytes long byte array * @return the integer number */ - public static int byteArray4ToInt(byte[] ba) { + public static int byteArray4ToInt(final byte[] ba) { if (ba == null || ba.length != 4) { return 0; } @@ -68,7 +68,7 @@ public abstract class NetUtils { * Zero is returned if {@code ba} is {@code null} or * the length of it is not six. */ - public static long byteArray6ToLong(byte[] ba) { + public static long byteArray6ToLong(final byte[] ba) { if (ba == null || ba.length != MACAddrLengthInBytes) { return 0L; } @@ -107,7 +107,7 @@ public abstract class NetUtils { * the integer number * @return the byte array */ - public static byte[] intToByteArray4(int i) { + public static byte[] intToByteArray4(final int i) { return new byte[] { (byte) ((i >> 24) & 0xff), (byte) ((i >> 16) & 0xff), (byte) ((i >> 8) & 0xff), (byte) (i & 0xff) }; } @@ -120,11 +120,11 @@ public abstract class NetUtils { * the IP address in integer form * @return the IP address in InetAddress form */ - public static InetAddress getInetAddress(int address) { + public static InetAddress getInetAddress(final int address) { InetAddress ip = null; try { ip = InetAddress.getByAddress(NetUtils.intToByteArray4(address)); - } catch (UnknownHostException e) { + } catch (final UnknownHostException e) { logger.error("", e); } return ip; @@ -142,7 +142,7 @@ public abstract class NetUtils { * boolean representing the IP version of the returned address * @return */ - public static InetAddress getInetNetworkMask(int prefixMaskLength, boolean isV6) { + public static InetAddress getInetNetworkMask(final int prefixMaskLength, final boolean isV6) { if (prefixMaskLength < 0 || (!isV6 && prefixMaskLength > 32) || (isV6 && prefixMaskLength > 128)) { return null; } @@ -165,7 +165,7 @@ public abstract class NetUtils { try { return InetAddress.getByAddress(address); - } catch (UnknownHostException e) { + } catch (final UnknownHostException e) { logger.error("", e); } return null; @@ -180,7 +180,7 @@ public abstract class NetUtils { * the subnet mask as byte array * @return the prefix length as number of bits */ - public static int getSubnetMaskLength(byte[] subnetMask) { + public static int getSubnetMaskLength(final byte[] subnetMask) { int maskLength = 0; if (subnetMask != null && (subnetMask.length == 4 || subnetMask.length == 16)) { int index = 0; @@ -208,7 +208,7 @@ public abstract class NetUtils { * the subnet mask as InetAddress * @return the prefix length as number of bits */ - public static int getSubnetMaskLength(InetAddress subnetMask) { + public static int getSubnetMaskLength(final InetAddress subnetMask) { return subnetMask == null ? 0 : NetUtils.getSubnetMaskLength(subnetMask.getAddress()); } @@ -223,7 +223,7 @@ public abstract class NetUtils { * the length of the prefix network mask * @return the subnet prefix IP address in InetAddress form */ - public static InetAddress getSubnetPrefix(InetAddress ip, int maskLen) { + public static InetAddress getSubnetPrefix(final InetAddress ip, final int maskLen) { int bytes = maskLen / 8; int bits = maskLen % 8; byte modifiedByte; @@ -238,7 +238,7 @@ public abstract class NetUtils { } try { return InetAddress.getByAddress(sn); - } catch (UnknownHostException e) { + } catch (final UnknownHostException e) { return null; } } @@ -268,8 +268,8 @@ public abstract class NetUtils { * @param filterMask * @return */ - public static boolean inetAddressConflict(InetAddress testAddress, InetAddress filterAddress, InetAddress testMask, - InetAddress filterMask) { + public static boolean inetAddressConflict(final InetAddress testAddress, final InetAddress filterAddress, final InetAddress testMask, + final InetAddress filterMask) { // Sanity check if ((testAddress == null) || (filterAddress == null)) { return false; @@ -303,7 +303,7 @@ public abstract class NetUtils { * the byte array representing the MAC address * @return true if all MAC bytes are zero */ - public static boolean isZeroMAC(byte[] mac) { + public static boolean isZeroMAC(final byte[] mac) { for (short i = 0; i < 6; i++) { if (mac[i] != 0) { return false; @@ -319,7 +319,7 @@ public abstract class NetUtils { * @param MACAddress * @return */ - public static boolean isBroadcastMACAddr(byte[] MACAddress) { + public static boolean isBroadcastMACAddr(final byte[] MACAddress) { if (MACAddress.length == MACAddrLengthInBytes) { for (int i = 0; i < 6; i++) { if (MACAddress[i] != BroadcastMACAddr[i]) { @@ -338,7 +338,7 @@ public abstract class NetUtils { * @param MACAddress * @return */ - public static boolean isUnicastMACAddr(byte[] MACAddress) { + public static boolean isUnicastMACAddr(final byte[] MACAddress) { if (MACAddress.length == MACAddrLengthInBytes) { return (MACAddress[0] & 1) == 0; } @@ -353,7 +353,7 @@ public abstract class NetUtils { * @param MACAddress * @return */ - public static boolean isMulticastMACAddr(byte[] MACAddress) { + public static boolean isMulticastMACAddr(final byte[] MACAddress) { if (MACAddress.length == MACAddrLengthInBytes && !isBroadcastMACAddr(MACAddress)) { return (MACAddress[0] & 1) != 0; } @@ -367,7 +367,7 @@ public abstract class NetUtils { * the IP address to test * @return true if the address is all zero */ - public static boolean isAny(InetAddress ip) { + public static boolean isAny(final InetAddress ip) { for (byte b : ip.getAddress()) { if (b != 0) { return false; @@ -376,18 +376,18 @@ public abstract class NetUtils { return true; } - public static boolean fieldsConflict(int field1, int field2) { + public static boolean fieldsConflict(final int field1, final int field2) { if ((field1 == 0) || (field2 == 0) || (field1 == field2)) { return false; } return true; } - public static InetAddress parseInetAddress(String addressString) { + public static InetAddress parseInetAddress(final String addressString) { InetAddress address = null; try { address = InetAddress.getByName(addressString); - } catch (UnknownHostException e) { + } catch (final UnknownHostException e) { logger.error("", e); } return address; @@ -401,7 +401,7 @@ public abstract class NetUtils { * the v4 address as A.B.C.D/MM * @return */ - public static boolean isIPv4AddressValid(String cidr) { + public static boolean isIPv4AddressValid(final String cidr) { if (cidr == null) { return false; } @@ -430,7 +430,7 @@ public abstract class NetUtils { * the v6 address as A::1/MMM * @return */ - public static boolean isIPv6AddressValid(String cidr) { + public static boolean isIPv6AddressValid(final String cidr) { if (cidr == null) { return false; } @@ -443,7 +443,7 @@ public abstract class NetUtils { if (!(addr instanceof Inet6Address)) { return false; } - } catch (UnknownHostException ex) { + } catch (final UnknownHostException ex) { return false; } @@ -464,7 +464,7 @@ public abstract class NetUtils { * the v4 or v6 address as IP/MMM * @return */ - public static boolean isIPAddressValid(String cidr) { + public static boolean isIPAddressValid(final String cidr) { return NetUtils.isIPv4AddressValid(cidr) || NetUtils.isIPv6AddressValid(cidr); } @@ -479,7 +479,7 @@ public abstract class NetUtils { * the byte value * @return the int variable containing the unsigned byte value */ - public static int getUnsignedByte(byte b) { + public static int getUnsignedByte(final byte b) { return b & 0xFF; } @@ -490,7 +490,7 @@ public abstract class NetUtils { * the short value * @return the int variable containing the unsigned short value */ - public static int getUnsignedShort(short s) { + public static int getUnsignedShort(final short s) { return s & 0xFFFF; } @@ -501,11 +501,11 @@ public abstract class NetUtils { * true for IPv6, false for Ipv4 * @return The highest IPv4 or IPv6 address */ - public static InetAddress gethighestIP(boolean v6) { + public static InetAddress gethighestIP(final boolean v6) { try { return (v6) ? InetAddress.getByName("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff") : InetAddress .getByName("255.255.255.255"); - } catch (UnknownHostException e) { + } catch (final UnknownHostException e) { return null; } } diff --git a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/Packet.java b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/Packet.java index 8a4fa36970..0d8acb52b7 100644 --- a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/Packet.java +++ b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/Packet.java @@ -47,7 +47,7 @@ public abstract class Packet { corrupted = false; } - public Packet(boolean writeAccess) { + public Packet(final boolean writeAccess) { this.writeAccess = writeAccess; corrupted = false; } @@ -60,15 +60,15 @@ public abstract class Packet { return payload; } - public void setParent(Packet parent) { + public void setParent(final Packet parent) { this.parent = parent; } - public void setPayload(Packet payload) { + public void setPayload(final Packet payload) { this.payload = payload; } - public void setHeaderField(String headerField, byte[] readValue) { + public void setHeaderField(final String headerField, final byte[] readValue) { hdrFieldsMap.put(headerField, readValue); } @@ -83,7 +83,7 @@ public abstract class Packet { * @return Packet * @throws PacketException */ - public Packet deserialize(byte[] data, int bitOffset, int size) + public Packet deserialize(final byte[] data, final int bitOffset, final int size) throws PacketException { // Deserialize the header fields one by one @@ -98,7 +98,7 @@ public abstract class Packet { try { hdrFieldBytes = BitBufferHelper.getBits(data, startOffset, numBits); - } catch (BufferException e) { + } catch (final BufferException e) { throw new PacketException(e.getMessage()); } @@ -123,7 +123,7 @@ public abstract class Packet { if (payloadClass != null) { try { payload = payloadClass.newInstance(); - } catch (Exception e) { + } catch (final Exception e) { throw new RuntimeException( "Error parsing payload for Ethernet packet", e); } @@ -181,7 +181,7 @@ public abstract class Packet { try { BitBufferHelper.setBytes(packetBytes, fieldBytes, getfieldOffset(field), getfieldnumBits(field)); - } catch (BufferException e) { + } catch (final BufferException e) { throw new PacketException(e.getMessage()); } } @@ -257,7 +257,7 @@ public abstract class Packet { * * @return Integer - startOffset of the requested field */ - public int getfieldOffset(String fieldName) { + public int getfieldOffset(final String fieldName) { return hdrFieldCoordMap.get(fieldName).getLeft(); } @@ -268,7 +268,7 @@ public abstract class Packet { * * @return Integer - number of bits of the requested field */ - public int getfieldnumBits(String fieldName) { + public int getfieldnumBits(final String fieldName) { return hdrFieldCoordMap.get(fieldName).getRight(); } @@ -303,7 +303,7 @@ public abstract class Packet { * * @param payload The raw payload as byte array */ - public void setRawPayload(byte[] payload) { + public void setRawPayload(final byte[] payload) { this.rawPayload = Arrays.copyOf(payload, payload.length); } @@ -332,7 +332,7 @@ public abstract class Packet { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (this == obj) { return true; } diff --git a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/PacketException.java b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/PacketException.java index c69fc03e91..39300a2890 100644 --- a/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/PacketException.java +++ b/opendaylight/commons/liblldp/src/main/java/org/opendaylight/controller/liblldp/PacketException.java @@ -16,7 +16,7 @@ package org.opendaylight.controller.liblldp; public class PacketException extends Exception { private static final long serialVersionUID = 1L; - public PacketException(String message) { + public PacketException(final String message) { super(message); } } diff --git a/opendaylight/commons/liblldp/src/test/java/org/opendaylight/controller/liblldp/LLDPTest.java b/opendaylight/commons/liblldp/src/test/java/org/opendaylight/controller/liblldp/LLDPTest.java index 7d27d80d52..6716ffa085 100644 --- a/opendaylight/commons/liblldp/src/test/java/org/opendaylight/controller/liblldp/LLDPTest.java +++ b/opendaylight/commons/liblldp/src/test/java/org/opendaylight/controller/liblldp/LLDPTest.java @@ -211,15 +211,15 @@ public class LLDPTest { * @param customItem * @param expectedValue */ - private static void checkCustomTlv(LLDPTLV customItem, String expectedValue) { + private static void checkCustomTlv(final LLDPTLV customItem, final String expectedValue) { Assert.assertEquals(127, customItem.getType()); LOG.debug("custom TLV1.length: {}", customItem.getLength()); Assert.assertEquals(expectedValue, new String(LLDPTLV.getCustomString(customItem.getValue(), customItem.getLength()))); } - private static int checkTLV(byte[] serializedData, int offset, byte typeTLVBits, String typeTLVName, - short lengthTLV, byte[] valueTLV, byte... bytesBeforeValue) throws ArrayComparisonFailure { + private static int checkTLV(final byte[] serializedData, final int offset, final byte typeTLVBits, final String typeTLVName, + final short lengthTLV, final byte[] valueTLV, final byte... bytesBeforeValue) throws ArrayComparisonFailure { byte[] concreteTlvAwaited = awaitedBytes(typeTLVBits, lengthTLV, valueTLV, bytesBeforeValue); int concreteTlvAwaitLength = concreteTlvAwaited.length; assertArrayEquals("Serialization problem " + typeTLVName, concreteTlvAwaited, @@ -227,7 +227,7 @@ public class LLDPTest { return offset + concreteTlvAwaitLength; } - private static byte[] awaitedBytes(byte typeTLV, short length, byte[] value, byte[] bytesBeforeValue) { + private static byte[] awaitedBytes(final byte typeTLV, final short length, final byte[] value, final byte[] bytesBeforeValue) { byte[] awaited = ArrayUtils.EMPTY_BYTE_ARRAY; // 0 - the less meaning byte (right), 1 most meaning byte (left) @@ -240,8 +240,8 @@ public class LLDPTest { return awaited; } - private static LLDPTLV dummyCustomTlv(final byte tlvType, byte[] oui, byte[] ouiSubtype, short customLength, - byte[] subtypeValue) { + private static LLDPTLV dummyCustomTlv(final byte tlvType, final byte[] oui, final byte[] ouiSubtype, final short customLength, + final byte[] subtypeValue) { byte[] fullCustomValue = new byte[0]; fullCustomValue = ArrayUtils.addAll(fullCustomValue, oui); fullCustomValue = ArrayUtils.addAll(fullCustomValue, ouiSubtype); diff --git a/opendaylight/commons/liblldp/src/test/java/org/opendaylight/controller/sal/packet/address/EthernetAddressTest.java b/opendaylight/commons/liblldp/src/test/java/org/opendaylight/controller/sal/packet/address/EthernetAddressTest.java index 6c74e9d4b1..5730dc75e9 100644 --- a/opendaylight/commons/liblldp/src/test/java/org/opendaylight/controller/sal/packet/address/EthernetAddressTest.java +++ b/opendaylight/commons/liblldp/src/test/java/org/opendaylight/controller/sal/packet/address/EthernetAddressTest.java @@ -31,7 +31,7 @@ public class EthernetAddressTest { // Exception is expected if NOT raised test will fail Assert.assertTrue(false); - } catch (ConstructionException e) { + } catch (final ConstructionException e) { } // Array too short @@ -40,7 +40,7 @@ public class EthernetAddressTest { // Exception is expected if NOT raised test will fail Assert.assertTrue(false); - } catch (ConstructionException e) { + } catch (final ConstructionException e) { } // Array too long @@ -51,7 +51,7 @@ public class EthernetAddressTest { // Exception is expected if NOT raised test will fail Assert.assertTrue(false); - } catch (ConstructionException e) { + } catch (final ConstructionException e) { } } @@ -66,7 +66,7 @@ public class EthernetAddressTest { ea2 = new EthernetAddress(new byte[] { (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x1 }); Assert.assertTrue(ea1.equals(ea2)); - } catch (ConstructionException e) { + } catch (final ConstructionException e) { // Exception is NOT expected if raised test will fail Assert.assertTrue(false); } @@ -77,7 +77,7 @@ public class EthernetAddressTest { ea2 = ea1.clone(); Assert.assertTrue(ea1.equals(ea2)); - } catch (ConstructionException e) { + } catch (final ConstructionException e) { // Exception is NOT expected if raised test will fail Assert.assertTrue(false); } @@ -88,7 +88,7 @@ public class EthernetAddressTest { ea2 = new EthernetAddress(new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff }); Assert.assertTrue(ea1.equals(ea2)); - } catch (ConstructionException e) { + } catch (final ConstructionException e) { // Exception is NOT expected if raised test will fail Assert.assertTrue(false); } @@ -105,7 +105,7 @@ public class EthernetAddressTest { ea2 = new EthernetAddress(new byte[] { (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x0, (byte) 0x1 }); Assert.assertTrue(!ea1.equals(ea2)); - } catch (ConstructionException e) { + } catch (final ConstructionException e) { // Exception is NOT expected if raised test will fail Assert.assertTrue(false); } -- 2.36.6