Enable checkstyle rule to check for boolean simplifications
Enable the checkstyle "SimplifyBooleanExpression" rule and
fix any violations it reports.
Change-Id: If8a0226829da3339b9209324a8ea36a28f2138c4
diff --git a/conf/checkstyle/sun_checks.xml b/conf/checkstyle/sun_checks.xml
index db7e909..47121a6 100644
--- a/conf/checkstyle/sun_checks.xml
+++ b/conf/checkstyle/sun_checks.xml
@@ -219,10 +219,7 @@
<property name="severity" value="warning"/>
</module>
- <module name="SimplifyBooleanExpression">
- <property name="severity" value="warning"/>
- </module>
-
+ <module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<!-- Checks for class design -->
diff --git a/src/main/java/net/onrc/onos/apps/bgproute/Ptree.java b/src/main/java/net/onrc/onos/apps/bgproute/Ptree.java
index e370fdf..3c51c90 100644
--- a/src/main/java/net/onrc/onos/apps/bgproute/Ptree.java
+++ b/src/main/java/net/onrc/onos/apps/bgproute/Ptree.java
@@ -37,14 +37,14 @@
while (node != null
&& node.keyBits <= keyBits
- && key_match(node.key, node.keyBits, key, keyBits) == true) {
+ && key_match(node.key, node.keyBits, key, keyBits)) {
if (node.keyBits == keyBits) {
return addReference(node);
}
match = node;
- if (bit_check(key, node.keyBits) == true) {
+ if (bit_check(key, node.keyBits)) {
node = node.right;
} else {
node = node.left;
@@ -91,12 +91,12 @@
while (node != null
&& node.keyBits <= keyBits
- && key_match(node.key, node.keyBits, key, keyBits) == true) {
+ && key_match(node.key, node.keyBits, key, keyBits)) {
if (node.keyBits == keyBits) {
return addReference(node);
}
- if (bit_check(key, node.keyBits) == true) {
+ if (bit_check(key, node.keyBits)) {
node = node.right;
} else {
node = node.left;
@@ -116,10 +116,10 @@
while (node != null
&& node.keyBits <= keyBits
- && key_match(node.key, node.keyBits, key, keyBits) == true) {
+ && key_match(node.key, node.keyBits, key, keyBits)) {
matched = node;
- if (bit_check(key, node.keyBits) == true) {
+ if (bit_check(key, node.keyBits)) {
node = node.right;
} else {
node = node.left;
@@ -230,7 +230,7 @@
private void node_link(PtreeNode node, PtreeNode add) {
boolean bit = bit_check(add.key, node.keyBits);
- if (bit == true) {
+ if (bit) {
node.right = add;
} else {
node.left = add;
diff --git a/src/main/java/net/onrc/onos/apps/forwarding/Forwarding.java b/src/main/java/net/onrc/onos/apps/forwarding/Forwarding.java
index 77703e5..08a68b6 100644
--- a/src/main/java/net/onrc/onos/apps/forwarding/Forwarding.java
+++ b/src/main/java/net/onrc/onos/apps/forwarding/Forwarding.java
@@ -386,7 +386,7 @@
}
}
- if (isflowEntryForThisSwitch == false) {
+ if (!isflowEntryForThisSwitch) {
// If we don't find a flow entry for that switch, then we're
// in the middle of a rerouting (or something's gone wrong).
// This packet will be dropped as a victim of the rerouting.
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 56e4231..0bcb001 100644
--- a/src/main/java/net/onrc/onos/core/flowprogrammer/FlowPusher.java
+++ b/src/main/java/net/onrc/onos/core/flowprogrammer/FlowPusher.java
@@ -835,7 +835,7 @@
}
if (actionStripVlan != null) {
- if (actionStripVlan.stripVlan() == true) {
+ if (actionStripVlan.stripVlan()) {
OFActionStripVirtualLan ofa = new OFActionStripVirtualLan();
openFlowActions.add(ofa);
actionsLen += ofa.getLength();
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 c12cf7e..a764f1c 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
@@ -378,7 +378,7 @@
* @param npt
*/
protected void addToQuarantineQueue(NodePortTuple npt) {
- if (quarantineQueue.contains(npt) == false) {
+ if (!quarantineQueue.contains(npt)) {
quarantineQueue.add(npt);
}
}
@@ -404,7 +404,7 @@
// TODO We are not checking if the switch port tuple is already
// in the maintenance list or not. This will be an issue for
// really large number of switch ports in the network.
- if (maintenanceQueue.contains(npt) == false) {
+ if (!maintenanceQueue.contains(npt)) {
maintenanceQueue.add(npt);
}
}
@@ -850,7 +850,7 @@
}
}
- if (myLLDP == false) {
+ if (!myLLDP) {
// This is not the LLDP sent by this controller.
// If the LLDP message has multicast bit set, then we need to broadcast
// the packet as a regular packet.
@@ -944,7 +944,7 @@
// reverse link.
newLinkInfo = links.get(lt);
- if (newLinkInfo != null && isStandard && isReverse == false) {
+ if (newLinkInfo != null && isStandard && !isReverse) {
Link reverseLink = new Link(lt.getDst(), lt.getDstPort(),
lt.getSrc(), lt.getSrcPort());
LinkInfo reverseInfo = links.get(reverseLink);
@@ -998,7 +998,7 @@
}
// It could be a packet other than BSN LLDP, therefore
// continue with the regular processing.
- if (bsn.getPayload() instanceof LLDP == false) {
+ if (!(bsn.getPayload() instanceof LLDP)) {
return Command.CONTINUE;
}
return handleLldp((LLDP) bsn.getPayload(), sw, pi, false, cntx);