Fix high priority findbugs reported issues
Fixed some code that was reporting findbugs errors
Implemented a suppression mechanism for findbugs
reported errors and a suppression file.
Change-Id: Ie8a2e84cc57ec6ddfa14d782ee89feb095b9dd59
diff --git a/utils/misc/src/main/java/org/onlab/packet/UDP.java b/utils/misc/src/main/java/org/onlab/packet/UDP.java
index 73a196a..19e23c0 100644
--- a/utils/misc/src/main/java/org/onlab/packet/UDP.java
+++ b/utils/misc/src/main/java/org/onlab/packet/UDP.java
@@ -27,18 +27,18 @@
*/
public class UDP extends BasePacket {
- public static Map<Short, Class<? extends IPacket>> decodeMap;
+ public static final Map<Short, Class<? extends IPacket>> DECODE_MAP =
+ new HashMap<>();
public static final short DHCP_SERVER_PORT = (short) 67;
public static final short DHCP_CLIENT_PORT = (short) 68;
static {
- UDP.decodeMap = new HashMap<Short, Class<? extends IPacket>>();
/*
* Disable DHCP until the deserialize code is hardened to deal with
* garbage input
*/
- UDP.decodeMap.put(UDP.DHCP_SERVER_PORT, DHCP.class);
- UDP.decodeMap.put(UDP.DHCP_CLIENT_PORT, DHCP.class);
+ UDP.DECODE_MAP.put(UDP.DHCP_SERVER_PORT, DHCP.class);
+ UDP.DECODE_MAP.put(UDP.DHCP_CLIENT_PORT, DHCP.class);
}
@@ -231,16 +231,16 @@
this.length = bb.getShort();
this.checksum = bb.getShort();
- if (UDP.decodeMap.containsKey(this.destinationPort)) {
+ if (UDP.DECODE_MAP.containsKey(this.destinationPort)) {
try {
- this.payload = UDP.decodeMap.get(this.destinationPort)
+ this.payload = UDP.DECODE_MAP.get(this.destinationPort)
.getConstructor().newInstance();
} catch (final Exception e) {
throw new RuntimeException("Failure instantiating class", e);
}
- } else if (UDP.decodeMap.containsKey(this.sourcePort)) {
+ } else if (UDP.DECODE_MAP.containsKey(this.sourcePort)) {
try {
- this.payload = UDP.decodeMap.get(this.sourcePort)
+ this.payload = UDP.DECODE_MAP.get(this.sourcePort)
.getConstructor().newInstance();
} catch (final Exception e) {
throw new RuntimeException("Failure instantiating class", e);