Small Java related improvements. 78/3978/1
authorAlissa Bonas <abonas@redhat.com>
Mon, 30 Dec 2013 15:59:26 +0000 (17:59 +0200)
committerAlissa Bonas <abonas@redhat.com>
Mon, 30 Dec 2013 16:01:15 +0000 (18:01 +0200)
Remove redundant return statement from void method,
remove redundant boxing of numeric variables,
remove statements that check a condition that is always 'true',
add braces to 'if else' statements.

Signed-off-by: Alissa Bonas <abonas@redhat.com>
ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/ConfigurationService.java
ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/ConnectionService.java
ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/InventoryService.java

index 5c6333ec01010ef1fc281dc1eb943bef81a620f0..ccb386e92aad008f9b6d3718e91938d718ed04d8 100644 (file)
@@ -2007,16 +2007,21 @@ public class ConfigurationService implements IPluginInBridgeDomainConfigService,
 
     public void _forceConnect (CommandInterpreter ci) {
         String force = ci.nextArgument();
-        if (force.equalsIgnoreCase("YES")) forceConnect = true;
-        else if (force.equalsIgnoreCase("NO")) forceConnect = false;
-        else ci.println("Please enter YES or NO.");
+        if (force.equalsIgnoreCase("YES")) {
+            forceConnect = true;
+        }
+        else if (force.equalsIgnoreCase("NO")) {
+            forceConnect = false;
+        }
+        else {
+            ci.println("Please enter YES or NO.");
+        }
         ci.println("Current ForceConnect State : "+forceConnect);
-        return;
     }
 
     @Override
     public String getHelp() {
-        StringBuffer help = new StringBuffer();
+        StringBuilder help = new StringBuilder();
         help.append("---OVSDB CLI---\n");
         help.append("\t ovsconnect <ConnectionName> <ip-address>                        - Connect to OVSDB\n");
         help.append("\t addBridge <Node> <BridgeName>                                   - Add Bridge\n");
index 3336a3e97152b58feb241120eb84151314ceb3a5..7cfac4b5072ed8f0cd11f40f977177dd4923bc57 100644 (file)
@@ -108,7 +108,7 @@ public class ConnectionService implements IPluginInConnectionService, IConnectio
         int listenPort = defaultOvsdbPort;
         String portString = System.getProperty("ovsdb.listenPort");
         if (portString != null) {
-            listenPort = Integer.decode(portString).intValue();
+            listenPort = Integer.decode(portString);
         }
         ovsdbListenPort = listenPort;
     }
@@ -455,7 +455,7 @@ public class ConnectionService implements IPluginInConnectionService, IConnectio
         String portString = System.getProperty("of.listenPort");
         if (portString != null) {
             try {
-                openFlowPort = Short.decode(portString).shortValue();
+                openFlowPort = Short.decode(portString);
             } catch (NumberFormatException e) {
                 logger.warn("Invalid port:{}, use default({})", portString,
                         openFlowPort);
index 94b89f1cd46439624e882a64836a2f434e9fd213..66a69a501d23ac6623ce32b3b396854dfe8a8156 100644 (file)
@@ -100,16 +100,11 @@ public class InventoryService implements IPluginInInventoryService, InventorySer
     }
 
     public void setPluginOutInventoryServices(IPluginOutInventoryService service) {
-        if (this.pluginOutInventoryServices != null) {
             this.pluginOutInventoryServices.add(service);
-        }
     }
 
-    public void unsetPluginOutInventoryServices(
-            IPluginOutInventoryService service) {
-        if (this.pluginOutInventoryServices != null) {
+    public void unsetPluginOutInventoryServices(IPluginOutInventoryService service) {
             this.pluginOutInventoryServices.remove(service);
-        }
     }
 
     /**