Add curly braces to if/else statements. (sonar) 24/1124/4
authorAlissa Bonas <abonas@redhat.com>
Sun, 8 Sep 2013 16:51:05 +0000 (19:51 +0300)
committerAlissa Bonas <abonas@redhat.com>
Tue, 10 Sep 2013 16:34:58 +0000 (19:34 +0300)
Change-Id: I34d30294615e98a2a76f8096f4edb50cabab7f24
Signed-off-by: Alissa Bonas <abonas@redhat.com>
opendaylight/connectionmanager/implementation/src/main/java/org/opendaylight/controller/connectionmanager/internal/ConnectionManager.java
opendaylight/hosttracker_new/api/src/main/java/org/opendaylight/controller/hosttracker/Entity.java
opendaylight/hosttracker_new/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/Device.java
opendaylight/hosttracker_new/implementation/src/main/java/org/opendaylight/controller/hosttracker/internal/DeviceManagerImpl.java
opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/Subnet.java
third-party/openflowj/src/main/java/org/openflow/protocol/OFError.java
third-party/openflowj/src/main/java/org/openflow/protocol/action/ActionVendorOutputNextHop.java

index e2d8f6b..da00e9c 100644 (file)
@@ -352,16 +352,21 @@ public class ConnectionManager implements IConnectionManager, IConnectionListene
         String controller = ci.nextArgument();
         if (controller == null) {
             ci.println("Nodes connected to this controller : ");
-            if (this.getLocalNodes() == null) ci.println("None");
-            else ci.println(this.getLocalNodes().toString());
+            if (this.getLocalNodes() == null) {
+                ci.println("None");
+            } else {
+                ci.println(this.getLocalNodes().toString());
+            }
             return;
         }
         try {
             InetAddress address = InetAddress.getByName(controller);
             ci.println("Nodes connected to controller "+controller);
-            if (this.getNodes(address) == null) ci.println("None");
-            else ci.println(this.getNodes(address).toString());
-            return;
+            if (this.getNodes(address) == null) {
+                ci.println("None");
+            } else {
+                ci.println(this.getNodes(address).toString());
+            }
         } catch (UnknownHostException e) {
             e.printStackTrace();
         }
index 924d071..64f4c7e 100644 (file)
@@ -244,10 +244,12 @@ public class Entity implements Comparable<Entity> {
     @Override
     public int compareTo(Entity o) {
         int r;
-        if (port == null)
+        if (port == null) {
             r = o.port == null ? 0 : -1;
-        else if (o.port == null)
+        }
+        else if (o.port == null) {
             r = 1;
+        }
         else {
             // XXX - the node id is only defined as an object rather
             // than something useful. We're just going to have to
index fb81cdd..b218029 100755 (executable)
@@ -181,7 +181,8 @@ public class Device implements IDevice {
      * @param newEntity
      *            the entity to add. newEntity must be have the same entity
      *            class as device
-     * @param if positive indicates the index in the entities array were the new
+     * @param insertionpoint
+     *        if positive indicates the index in the entities array were the new
      *        entity should be inserted. If negative we will compute the correct
      *        insertion point
      */
@@ -240,10 +241,11 @@ public class Device implements IDevice {
 
         TreeSet<Short> vals = new TreeSet<Short>();
         for (Entity e : entities) {
-            if (e.getVlan() == null)
+            if (e.getVlan() == null) {
                 vals.add((short) -1);
-            else
+            } else {
                 vals.add(e.getVlan());
+            }
         }
         return vals.toArray(new Short[vals.size()]);
     }
@@ -313,15 +315,16 @@ public class Device implements IDevice {
             return false;
 
         for (AttachmentPoint ap : apList) {
-            if (ap.getLastSeen() + AttachmentPoint.INACTIVITY_INTERVAL < System
-                    .currentTimeMillis())
-                expiredAPs.add(ap);
+            if (ap.getLastSeen() + AttachmentPoint.INACTIVITY_INTERVAL < System.currentTimeMillis()) {
+               expiredAPs.add(ap);
+            }
         }
         if (expiredAPs.size() > 0) {
             apList.removeAll(expiredAPs);
             return true;
-        } else
+        } else {
             return false;
+        }
     }
 
     /**
@@ -410,7 +413,6 @@ public class Device implements IDevice {
      * any change to the list of attachment points for the device -- which
      * indicates a device move.
      *
-     * @param sw
      * @param port
      * @param lastSeen
      * @return
@@ -525,7 +527,6 @@ public class Device implements IDevice {
     /**
      * Delete (sw,port) from the list of list of attachment points and oldAPs.
      *
-     * @param sw
      * @param port
      * @return
      */
@@ -703,10 +704,12 @@ public class Device implements IDevice {
         TreeSet<Short> vals = new TreeSet<Short>();
         for (Entity e : entities) {
             if (e.getPort().equals(swp.getPort())) {
-                if (e.getVlan() == null)
+                if (e.getVlan() == null) {
                     vals.add(VLAN_UNTAGGED);
-                else
+                }
+                else  {
                     vals.add(e.getVlan());
+                }
             }
         }
         return vals.toArray(new Short[vals.size()]);
index 95d33ce..0390907 100755 (executable)
@@ -385,11 +385,11 @@ public class DeviceManagerImpl implements IDeviceService, IEntityClassListener,
             long newDomain = 0;
             boolean newBD = false;
 
-            if (oldDomain < newDomain)
-                return -1;
-            else if (oldDomain > newDomain)
+            if (oldDomain < newDomain) {
+               return -1;
+            } else if (oldDomain > newDomain) {
                 return 1;
-
+            }
             // Give preference to OFPP_LOCAL always
             if (!oldAP.getPort().getType().equals(NodeConnectorIDType.SWSTACK)
                     && newAP.getPort().getType()
index 55a7ecb..1deda7c 100644 (file)
@@ -156,16 +156,20 @@ public class Subnet implements Cloneable, Serializable {
     }
 
     public boolean isSubnetOf(InetAddress ip) {
-        if (ip == null)
+        if (ip == null) {
             return false;
+        }
         InetAddress thisPrefix = getPrefixForAddress(this.networkAddress);
         InetAddress otherPrefix = getPrefixForAddress(ip);
-        if ((thisPrefix == null) || (otherPrefix == null))
+        if ((thisPrefix == null) || (otherPrefix == null)) {
             return false;
-        if (thisPrefix.equals(otherPrefix))
+        }
+        if (thisPrefix.equals(otherPrefix)) {
             return true;
-        else
+        }
+        else {
             return false;
+        }
     }
 
     public short getVlan() {
index 74e39b2..361a03b 100644 (file)
@@ -128,10 +128,11 @@ public class OFError extends OFMessage implements OFMessageFactoryAware {
         // OVS apparently sends partial messages in errors
         // need to be careful of that AND can't use data.limit() as
         // a packet boundary because there could be more data queued
-        if (messages.size() > 0)
+        if (messages.size() > 0) {
             return messages.get(0);
-        else
+        } else {
             return null;
+        }
     }
 
     /**
index d5e5ab0..f26ca51 100644 (file)
@@ -74,11 +74,12 @@ import org.openflow.util.HexString;
                
                public void setNextHop(InetAddress address) {
                        short actionLen;
-                       if (address instanceof Inet4Address) 
-                               actionLen = (short)ONHLength.ONH_LEN_IPV4.getValue();
-                       else
-                               actionLen = (short)ONHLength.ONH_LEN_IPV6.getValue();
-                       super.setLength(actionLen);
+                       if (address instanceof Inet4Address) {
+                actionLen = (short)ONHLength.ONH_LEN_IPV4.getValue();
+            } else {
+                actionLen = (short)ONHLength.ONH_LEN_IPV6.getValue();
+            }
+            super.setLength(actionLen);
                        this.address = address;
                }
                public InetAddress getNextHop() {