Update findbugs versions.
- Update findbugs and maven plugins to 2.0.3 and 2.5.4.
- Fix for bugs detected by new version of findbugs
Note:
If you see "dependencies could not be resolved" error,
running "mvn clean verify -U" to force maven to check for new version in
remote repository might resolve the issue.
Change-Id: I26661aaf5d791980b0ab161649022e5bb7cf045d
diff --git a/pom.xml b/pom.xml
index 0274bb8..1de66ca 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,8 +35,8 @@
<cobertura-maven-plugin.version>2.6</cobertura-maven-plugin.version>
<!-- Following 2 findbugs version needs to be updated in sync to match the
findbugs version used in findbugs-plugin -->
- <findbugs.version>2.0.2</findbugs.version>
- <findbugs-plugin.version>2.5.3</findbugs-plugin.version>
+ <findbugs.version>2.0.3</findbugs.version>
+ <findbugs-plugin.version>2.5.4</findbugs-plugin.version>
<findbugs.effort>Max</findbugs.effort>
<findbugs.excludeFilterFile>conf/findbugs/exclude.xml</findbugs.excludeFilterFile>
<checkstyle-plugin.version>2.12</checkstyle-plugin.version>
diff --git a/src/main/java/net/onrc/onos/apps/sdnip/SdnIp.java b/src/main/java/net/onrc/onos/apps/sdnip/SdnIp.java
index 4e4e6fa..5db148c 100644
--- a/src/main/java/net/onrc/onos/apps/sdnip/SdnIp.java
+++ b/src/main/java/net/onrc/onos/apps/sdnip/SdnIp.java
@@ -376,7 +376,7 @@
Prefix p;
try {
- p = new Prefix(prefix1, Integer.valueOf(mask1));
+ p = new Prefix(prefix1, Integer.parseInt(mask1));
} catch (NumberFormatException e) {
log.warn("Wrong mask format in RIB JSON: {}", mask1);
continue;
diff --git a/src/main/java/net/onrc/onos/apps/sdnip/web/IncomingRequestResource.java b/src/main/java/net/onrc/onos/apps/sdnip/web/IncomingRequestResource.java
index 705c5f1..690ec4d 100644
--- a/src/main/java/net/onrc/onos/apps/sdnip/web/IncomingRequestResource.java
+++ b/src/main/java/net/onrc/onos/apps/sdnip/web/IncomingRequestResource.java
@@ -109,7 +109,7 @@
Prefix p;
long sysUpTime, sequenceNum;
try {
- p = new Prefix(prefix, Integer.valueOf(mask));
+ p = new Prefix(prefix, Integer.parseInt(mask));
sysUpTime = Long.parseLong(strSysuptime);
sequenceNum = Long.parseLong(strSequence);
} catch (NumberFormatException e) {
@@ -174,7 +174,7 @@
Prefix p;
long sysUpTime, sequenceNum;
try {
- p = new Prefix(prefix, Integer.valueOf(mask));
+ p = new Prefix(prefix, Integer.parseInt(mask));
sysUpTime = Long.parseLong(strSysuptime);
sequenceNum = Long.parseLong(strSequence);
} catch (NumberFormatException e) {
diff --git a/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZClient.java b/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZClient.java
index d3c303f..41d5853 100644
--- a/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZClient.java
+++ b/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZClient.java
@@ -45,7 +45,7 @@
private static boolean useClientMode = Boolean.parseBoolean(System.getProperty("net.onrc.onos.core.datastore.hazelcast.clientMode", "true"));
// Note: xml configuration will overwrite this value if present
- private static int backupCount = Integer.valueOf(System.getProperty("net.onrc.onos.core.datastore.hazelcast.backupCount", "3"));
+ private static int backupCount = Integer.parseInt(System.getProperty("net.onrc.onos.core.datastore.hazelcast.backupCount", "3"));
private final HazelcastInstance hazelcastInstance;
@@ -98,7 +98,7 @@
// set to 0 for fast fall back to Instance mode.
String sAttempts = System.getProperty("net.onrc.onos.core.datastore.hazelcast.client.attemptLimit");
if (sAttempts != null) {
- clientConfig.setConnectionAttemptLimit(Integer.valueOf(sAttempts).intValue());
+ clientConfig.setConnectionAttemptLimit(Integer.parseInt(sAttempts));
}
// copy group config from base Hazelcast configuration
diff --git a/src/main/java/net/onrc/onos/core/datastore/ramcloud/RCClient.java b/src/main/java/net/onrc/onos/core/datastore/ramcloud/RCClient.java
index 9096f8a..ff80494 100644
--- a/src/main/java/net/onrc/onos/core/datastore/ramcloud/RCClient.java
+++ b/src/main/java/net/onrc/onos/core/datastore/ramcloud/RCClient.java
@@ -61,7 +61,7 @@
* (Increasing the stack-size limit will help relaxing this limit.)
*/
public static final int MAX_MULTI_READS = Math.max(1, Integer
- .valueOf(System.getProperty("ramcloud.max_multi_reads", "400")));
+ .parseInt(System.getProperty("ramcloud.max_multi_reads", "400")));
/**
* Maximum number of Multi-Write operations which can be executed in
@@ -73,7 +73,7 @@
* (Increasing the stack-size limit will help relaxing this limit.)
*/
public static final int MAX_MULTI_WRITES = Math.max(1, Integer
- .valueOf(System.getProperty("ramcloud.max_multi_writes", "800")));
+ .parseInt(System.getProperty("ramcloud.max_multi_writes", "800")));
private static final ThreadLocal<JRamCloud> TLS_RC_CLIENT = new ThreadLocal<JRamCloud>() {
@Override
diff --git a/src/main/java/net/onrc/onos/core/flowprogrammer/FlowPusher.java b/src/main/java/net/onrc/onos/core/flowprogrammer/FlowPusher.java
index cba6ee1..661f5c0 100644
--- a/src/main/java/net/onrc/onos/core/flowprogrammer/FlowPusher.java
+++ b/src/main/java/net/onrc/onos/core/flowprogrammer/FlowPusher.java
@@ -341,7 +341,7 @@
for (IOFSwitch sw : keys) {
SwitchQueue queue = assignedQueues.get(sw);
- if (sw == null || queue == null) {
+ if (queue == null) {
continue;
}
diff --git a/src/main/java/net/onrc/onos/core/flowprogrammer/web/SetPushRateResource.java b/src/main/java/net/onrc/onos/core/flowprogrammer/web/SetPushRateResource.java
index 11bbd28..a2993a5 100644
--- a/src/main/java/net/onrc/onos/core/flowprogrammer/web/SetPushRateResource.java
+++ b/src/main/java/net/onrc/onos/core/flowprogrammer/web/SetPushRateResource.java
@@ -28,7 +28,7 @@
try {
dpid = HexString.toLong((String) getRequestAttributes().get("dpid"));
- rate = Long.valueOf((String) getRequestAttributes().get("rate"));
+ rate = Long.parseLong((String) getRequestAttributes().get("rate"));
} catch (NumberFormatException e) {
log.error("Invalid number format");
return false;
diff --git a/src/main/java/net/onrc/onos/core/intent/PathIntent.java b/src/main/java/net/onrc/onos/core/intent/PathIntent.java
index cc00979..4312075 100644
--- a/src/main/java/net/onrc/onos/core/intent/PathIntent.java
+++ b/src/main/java/net/onrc/onos/core/intent/PathIntent.java
@@ -15,7 +15,7 @@
public static String createNextId(String currentId) {
String[] parts = currentId.split("___");
- return String.format("%s___%d", parts[0], Long.valueOf(parts[1]) + 1);
+ return String.format("%s___%d", parts[0], Long.parseLong(parts[1]) + 1);
}
/**
diff --git a/src/main/java/net/onrc/onos/core/packet/IPv4.java b/src/main/java/net/onrc/onos/core/packet/IPv4.java
index f105428..1ce9eec 100644
--- a/src/main/java/net/onrc/onos/core/packet/IPv4.java
+++ b/src/main/java/net/onrc/onos/core/packet/IPv4.java
@@ -290,6 +290,7 @@
* -headerLength : 0
* -totalLength : 0
*/
+ @Override
public byte[] serialize() {
byte[] payloadData = null;
if (payload != null) {
@@ -410,7 +411,7 @@
int result = 0;
for (int i = 0; i < 4; ++i) {
- result |= Integer.valueOf(octets[i]) << ((3 - i) * 8);
+ result |= Integer.parseInt(octets[i]) << ((3 - i) * 8);
}
return result;
}
@@ -443,7 +444,7 @@
int result = 0;
for (int i = 0; i < 4; ++i) {
result = (ipAddress >> ((3 - i) * 8)) & 0xff;
- sb.append(Integer.valueOf(result).toString());
+ sb.append(Integer.toString(result));
if (i != 3) {
sb.append(".");
}
diff --git a/src/main/java/net/onrc/onos/core/util/IPv4.java b/src/main/java/net/onrc/onos/core/util/IPv4.java
index 0b5c081..047e8c6 100644
--- a/src/main/java/net/onrc/onos/core/util/IPv4.java
+++ b/src/main/java/net/onrc/onos/core/util/IPv4.java
@@ -54,7 +54,7 @@
int result = 0;
for (int i = 0; i < 4; ++i) {
- result |= Integer.valueOf(splits[i]) << ((3 - i) * 8);
+ result |= Integer.parseInt(splits[i]) << ((3 - i) * 8);
}
this.value = result;
}