Enable checkstyle rule to find empty code blocks
Enabled checkstyle rule that detects empty code blocks and fixed the
violations that were discovered.
Change-Id: Icc23e028f2bbabc1849ec566923aa125b2486a3b
diff --git a/src/main/java/net/onrc/onos/apps/bgproute/BgpRoute.java b/src/main/java/net/onrc/onos/apps/bgproute/BgpRoute.java
index a1258ff..73fac14 100644
--- a/src/main/java/net/onrc/onos/apps/bgproute/BgpRoute.java
+++ b/src/main/java/net/onrc/onos/apps/bgproute/BgpRoute.java
@@ -627,6 +627,7 @@
log.debug("Deleting flows for prefix {}", prefix);
Collection<FlowId> flowIds = pushedFlowIds.removeAll(prefix);
+/*
for (FlowId flowId : flowIds) {
// TODO: Delete the flow by using the new Path Intent framework
/*
@@ -644,8 +645,8 @@
{
log.debug("Failed to delete FlowId: {}",flowId);
}
- */
}
+*/
}
// TODO need to record the path and then delete here
diff --git a/src/main/java/net/onrc/onos/apps/bgproute/PatriciaTrie.java b/src/main/java/net/onrc/onos/apps/bgproute/PatriciaTrie.java
index 0650012..245b574 100644
--- a/src/main/java/net/onrc/onos/apps/bgproute/PatriciaTrie.java
+++ b/src/main/java/net/onrc/onos/apps/bgproute/PatriciaTrie.java
@@ -68,10 +68,6 @@
}
} else {
add = node_common(node, prefix.getAddress(), prefix.getPrefixLength());
- if (add == null) {
- //I think this is -ENOMEM?
- //return null;
- }
if (match != null) {
node_link(match, add);
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 cbe10be..4cc68b4 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
@@ -326,9 +326,7 @@
}
for (IMultiEntryOperation op : ops) {
IModifiableMultiEntryOperation mop = (IModifiableMultiEntryOperation) op;
- if (mop.hasSucceeded()) {
- // status update is already done, nothing to do.
- } else {
+ if (!mop.hasSucceeded()) {
failExists = true;
}
}
diff --git a/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZMultiEntryOperation.java b/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZMultiEntryOperation.java
index 88649e7..db354eb 100644
--- a/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZMultiEntryOperation.java
+++ b/src/main/java/net/onrc/onos/core/datastore/hazelcast/HZMultiEntryOperation.java
@@ -134,9 +134,6 @@
@Override
public void setVersion(final long version) {
- if (future != null) {
- // no-op on read
- }
if (writeValue == null) {
writeValue = new VersionedValue(null, version);
}
diff --git a/src/main/java/net/onrc/onos/core/intent/IntentMap.java b/src/main/java/net/onrc/onos/core/intent/IntentMap.java
index e5cae77..2124d25 100644
--- a/src/main/java/net/onrc/onos/core/intent/IntentMap.java
+++ b/src/main/java/net/onrc/onos/core/intent/IntentMap.java
@@ -148,6 +148,7 @@
Intent intent = getIntent(operation.intent.getId());
if (intent == null) {
// TODO error handling
+ return;
} else {
setState(intent.getId(), IntentState.DEL_REQ);
}
diff --git a/src/main/java/net/onrc/onos/core/linkdiscovery/internal/LinkDiscoveryManager.java b/src/main/java/net/onrc/onos/core/linkdiscovery/internal/LinkDiscoveryManager.java
index 7497106..6e0dc69 100644
--- a/src/main/java/net/onrc/onos/core/linkdiscovery/internal/LinkDiscoveryManager.java
+++ b/src/main/java/net/onrc/onos/core/linkdiscovery/internal/LinkDiscoveryManager.java
@@ -385,7 +385,11 @@
*/
protected void removeFromQuarantineQueue(NodePortTuple npt) {
// Remove all occurrences of the node port tuple from the list.
- while (quarantineQueue.remove(npt)) { }
+ boolean removedSomething;
+
+ do {
+ removedSomething = quarantineQueue.remove(npt);
+ } while (removedSomething);
}
/**
@@ -408,7 +412,10 @@
*/
protected void removeFromMaintenanceQueue(NodePortTuple npt) {
// Remove all occurrences of the node port tuple from the queue.
- while (maintenanceQueue.remove(npt)) { }
+ boolean removedSomething;
+ do {
+ removedSomething = maintenanceQueue.remove(npt);
+ } while (removedSomething);
}
/**
@@ -1335,8 +1342,10 @@
private void processNewPort(long sw, short p) {
if (isLinkDiscoverySuppressed(sw, p)) {
// Do nothing as link discovery is suppressed.
+ return;
} else if (autoPortFastFeature && isFastPort(sw, p)) {
// Do nothing as the port is a fast port.
+ return;
} else {
NodePortTuple npt = new NodePortTuple(sw, p);
discover(sw, p);
diff --git a/src/main/java/net/onrc/onos/core/topology/TopologyManager.java b/src/main/java/net/onrc/onos/core/topology/TopologyManager.java
index 4788641..d915042 100644
--- a/src/main/java/net/onrc/onos/core/topology/TopologyManager.java
+++ b/src/main/java/net/onrc/onos/core/topology/TopologyManager.java
@@ -773,6 +773,7 @@
} else {
// TODO: Update the switch attributes
// TODO: Nothing to do for now
+ log.debug("Update switch attributes");
}
apiAddedSwitchEvents.add(switchEvent);
}
@@ -828,6 +829,7 @@
switchImpl.addPort(port);
} else {
// TODO: Update the port attributes
+ log.debug("Update port attributes");
}
apiAddedPortEvents.add(portEvent);
}
@@ -942,6 +944,7 @@
removeDevice(deviceEvent);
} else {
// TODO: Update the link attributes
+ log.debug("Update link attributes");
}
apiAddedLinkEvents.add(linkEvent);