Enable checkstyle check for blocks without braces.
Enable the checkstyle rule to check for block statements
without curly braces and fix any violations it finds.
Change-Id: Id4c58cea26f0d9ce7ed78643a4943c042886a12d
diff --git a/src/main/java/net/onrc/onos/core/devicemanager/OnosDevice.java b/src/main/java/net/onrc/onos/core/devicemanager/OnosDevice.java
index adac787..09dea03 100644
--- a/src/main/java/net/onrc/onos/core/devicemanager/OnosDevice.java
+++ b/src/main/java/net/onrc/onos/core/devicemanager/OnosDevice.java
@@ -149,8 +149,9 @@
public void setLastSeenTimestamp(Date lastSeenTimestamp) {
if (activeSince == null ||
(activeSince.getTime() + ACTIVITY_TIMEOUT) <
- lastSeenTimestamp.getTime())
+ lastSeenTimestamp.getTime()) {
this.activeSince = lastSeenTimestamp;
+ }
this.lastSeenTimestamp = lastSeenTimestamp;
}
@@ -164,7 +165,9 @@
@Override
public int hashCode() {
- if (hashCode != 0) return hashCode;
+ if (hashCode != 0) {
+ return hashCode;
+ }
final int prime = 31;
hashCode = 1;
hashCode = prime * hashCode
@@ -178,22 +181,46 @@
@Override
public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null) return false;
- if (getClass() != obj.getClass()) return false;
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
OnosDevice other = (OnosDevice) obj;
- if (hashCode() != other.hashCode()) return false;
+ if (hashCode() != other.hashCode()) {
+ return false;
+ }
if (ipv4Address == null) {
- if (other.ipv4Address != null) return false;
- } else if (!ipv4Address.equals(other.ipv4Address)) return false;
+ if (other.ipv4Address != null) {
+ return false;
+ }
+ } else if (!ipv4Address.equals(other.ipv4Address)) {
+ return false;
+ }
if (macAddress == null) {
- if (other.macAddress != null) return false;
- } else if (!macAddress.equals(other.macAddress)) return false;
- if (switchDPID != other.switchDPID) return false;
- if (switchPort != other.switchPort) return false;
+ if (other.macAddress != null) {
+ return false;
+ }
+ } else if (!macAddress.equals(other.macAddress)) {
+ return false;
+ }
+ if (switchDPID != other.switchDPID) {
+ return false;
+ }
+ if (switchPort != other.switchPort) {
+ return false;
+ }
if (vlan == null) {
- if (other.vlan != null) return false;
- } else if (!vlan.equals(other.vlan)) return false;
+ if (other.vlan != null) {
+ return false;
+ }
+ } else if (!vlan.equals(other.vlan)) {
+ return false;
+ }
return true;
}
diff --git a/src/main/java/net/onrc/onos/core/devicemanager/OnosDeviceManager.java b/src/main/java/net/onrc/onos/core/devicemanager/OnosDeviceManager.java
index a724caa..231c1a0 100644
--- a/src/main/java/net/onrc/onos/core/devicemanager/OnosDeviceManager.java
+++ b/src/main/java/net/onrc/onos/core/devicemanager/OnosDeviceManager.java
@@ -251,8 +251,9 @@
long dlAddr = Ethernet.toLong(dlAddrArr);
// Ignore broadcast/multicast source
- if ((dlAddrArr[0] & 0x1) != 0)
+ if ((dlAddrArr[0] & 0x1) != 0) {
return null;
+ }
short vlan = eth.getVlanID();
int nwSrc = getSrcNwAddr(eth, dlAddr);