From 6b8bae482df3de2ecbe717b905c39ef2b1924065 Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Sun, 14 Dec 2014 11:21:37 -0500 Subject: [PATCH] Fix checkstyle if-statements must use braces hosttracker_new Change-Id: I8261723a288103deb227b99e72d558f6303a37d8 Signed-off-by: Thanh Ha --- .../controller/hosttracker/Entity.java | 39 ++++++++++++------- .../controller/hosttracker/SwitchPort.java | 18 ++++++--- .../hostAware/HostNodeConnector.java | 24 ++++++++---- 3 files changed, 54 insertions(+), 27 deletions(-) diff --git a/opendaylight/adsal/hosttracker_new/api/src/main/java/org/opendaylight/controller/hosttracker/Entity.java b/opendaylight/adsal/hosttracker_new/api/src/main/java/org/opendaylight/controller/hosttracker/Entity.java index 64f4c7ef1e..f10c116755 100644 --- a/opendaylight/adsal/hosttracker_new/api/src/main/java/org/opendaylight/controller/hosttracker/Entity.java +++ b/opendaylight/adsal/hosttracker_new/api/src/main/java/org/opendaylight/controller/hosttracker/Entity.java @@ -165,8 +165,9 @@ public class Entity implements Comparable { public void setLastSeenTimestamp(Date lastSeenTimestamp) { if (activeSince == null || (activeSince.getTime() + ACTIVITY_TIMEOUT) < lastSeenTimestamp - .getTime()) + .getTime()) { this.activeSince = lastSeenTimestamp; + } this.lastSeenTimestamp = lastSeenTimestamp; } @@ -180,8 +181,9 @@ public class Entity implements Comparable { @Override public int hashCode() { - if (hashCode != 0) + if (hashCode != 0) { return hashCode; + } final int prime = 31; hashCode = 1; hashCode = prime * hashCode @@ -194,30 +196,40 @@ public class Entity implements Comparable { @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } Entity other = (Entity) obj; if (ipv4Address == null) { - if (other.ipv4Address != null) + if (other.ipv4Address != null) { return false; - } else if (!ipv4Address.equals(other.ipv4Address)) + } + } else if (!ipv4Address.equals(other.ipv4Address)) { return false; - if (macAddress != other.macAddress) + } + if (macAddress != other.macAddress) { return false; + } if (port == null) { - if (other.port != null) + if (other.port != null) { return false; - } else if (!port.equals(other.port)) + } + } else if (!port.equals(other.port)) { return false; + } if (vlan == null) { - if (other.vlan != null) + if (other.vlan != null) { return false; - } else if (!vlan.equals(other.vlan)) + } + } else if (!vlan.equals(other.vlan)) { return false; + } return true; } @@ -257,8 +269,9 @@ public class Entity implements Comparable { Comparable switchId = (Comparable) port.getNode().getID(); Comparable oswitchId = (Comparable) o.port.getNode().getID(); r = switchId.compareTo(oswitchId); - if (r != 0) + if (r != 0) { return r; + } Comparable portId = (Comparable) port.getID(); Comparable oportId = (Comparable) o.port.getID(); diff --git a/opendaylight/adsal/hosttracker_new/api/src/main/java/org/opendaylight/controller/hosttracker/SwitchPort.java b/opendaylight/adsal/hosttracker_new/api/src/main/java/org/opendaylight/controller/hosttracker/SwitchPort.java index e60f8b4b0e..892e1d6c79 100644 --- a/opendaylight/adsal/hosttracker_new/api/src/main/java/org/opendaylight/controller/hosttracker/SwitchPort.java +++ b/opendaylight/adsal/hosttracker_new/api/src/main/java/org/opendaylight/controller/hosttracker/SwitchPort.java @@ -127,20 +127,26 @@ public class SwitchPort { @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } SwitchPort other = (SwitchPort) obj; - if (errorStatus != other.errorStatus) + if (errorStatus != other.errorStatus) { return false; + } if (port == null) { - if (other.port != null) + if (other.port != null) { return false; - } else if (!port.equals(other.port)) + } + } else if (!port.equals(other.port)) { return false; + } return true; } diff --git a/opendaylight/adsal/hosttracker_new/api/src/main/java/org/opendaylight/controller/hosttracker/hostAware/HostNodeConnector.java b/opendaylight/adsal/hosttracker_new/api/src/main/java/org/opendaylight/controller/hosttracker/hostAware/HostNodeConnector.java index fe396ba92b..86376be5c5 100644 --- a/opendaylight/adsal/hosttracker_new/api/src/main/java/org/opendaylight/controller/hosttracker/hostAware/HostNodeConnector.java +++ b/opendaylight/adsal/hosttracker_new/api/src/main/java/org/opendaylight/controller/hosttracker/hostAware/HostNodeConnector.java @@ -150,22 +150,29 @@ public class HostNodeConnector extends Host { @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (!super.equals(obj)) + } + if (!super.equals(obj)) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } HostNodeConnector other = (HostNodeConnector) obj; if (nodeConnector == null) { - if (other.nodeConnector != null) + if (other.nodeConnector != null) { return false; - } else if (!nodeConnector.equals(other.nodeConnector)) + } + } else if (!nodeConnector.equals(other.nodeConnector)) { return false; - if (staticHost != other.staticHost) + } + if (staticHost != other.staticHost) { return false; - if (vlan != other.vlan) + } + if (vlan != other.vlan) { return false; + } return true; } @@ -181,8 +188,9 @@ public class HostNodeConnector extends Host { EthernetAddress e = (EthernetAddress) getDataLayerAddress(); macaddr = e.getValue(); } - if (macaddr == null) + if (macaddr == null) { return false; + } return !Arrays.equals(emptyArray, macaddr); } -- 2.36.6