Avoid calling the String constructor explicitly 08/30208/1
authorStephen Kitt <skitt@redhat.com>
Wed, 25 Nov 2015 16:51:09 +0000 (17:51 +0100)
committerStephen Kitt <skitt@redhat.com>
Wed, 25 Nov 2015 16:51:09 +0000 (17:51 +0100)
Change-Id: I3f57df03746acafe11def7cdced65822b31117a5
Signed-off-by: Stephen Kitt <skitt@redhat.com>
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundMapper.java
openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/NetvirtIT.java
openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/SouthboundMapper.java
openstack/net-virt-sfc/impl/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/sfc/workaround/services/SfcClassifierService.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/BridgeConfigurationManagerImpl.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundUtil.java
southbound/southbound-impl/src/test/java/org/opendaylight/ovsdb/southbound/SouthboundUtilTest.java
southbound/southbound-it/src/test/java/org/opendaylight/ovsdb/southbound/it/SouthboundIT.java
utils/southbound-utils/src/main/java/org/opendaylight/ovsdb/utils/southbound/utils/SouthboundUtils.java

index 1c87b838c623ae4e7d170da441d8182b3c924a85..5e2697442025efdfe77261fe03e228c8096b9914 100644 (file)
@@ -59,7 +59,7 @@ public class HwvtepSouthboundMapper {
 
     private static InstanceIdentifier<Node> createInstanceIdentifier(IpAddress ip, PortNumber port) {
         String uriString = HwvtepSouthboundConstants.HWVTEP_URI_PREFIX + "://"
-                + new String(ip.getValue()) + ":" + port.getValue();
+                + String.valueOf(ip.getValue()) + ":" + port.getValue();
         Uri uri = new Uri(uriString);
         NodeId nodeId = new NodeId(uri);
         InstanceIdentifier<Node> path = InstanceIdentifier.create(NetworkTopology.class)
index d335bfa6765694408e31655a38ffb204b32bf20e..71fe6e47aceac28965a1534fbe7896268add902e 100644 (file)
@@ -331,7 +331,7 @@ public class NetvirtIT extends AbstractMdsalTestBase {
     }
 
     private String connectionInfoToString(final ConnectionInfo connectionInfo) {
-        return new String(connectionInfo.getRemoteIp().getValue()) + ":" + connectionInfo.getRemotePort().getValue();
+        return String.valueOf(connectionInfo.getRemoteIp().getValue()) + ":" + connectionInfo.getRemotePort().getValue();
     }
 
     private boolean addOvsdbNode(final ConnectionInfo connectionInfo) throws InterruptedException {
@@ -437,7 +437,7 @@ public class NetvirtIT extends AbstractMdsalTestBase {
                         } else if (tokens[0].equalsIgnoreCase("ptcp")) {
                             ConnectionInfo connectionInfo = ovsdbNodeAugmentation.getConnectionInfo();
                             if (connectionInfo != null && connectionInfo.getLocalIp() != null) {
-                                controllerIpStr = new String(connectionInfo.getLocalIp().getValue());
+                                controllerIpStr = String.valueOf(connectionInfo.getLocalIp().getValue());
                                 controllersStr.add(Constants.OPENFLOW_CONNECTION_PROTOCOL
                                         + ":" + controllerIpStr + ":" + Constants.OPENFLOW_PORT);
                             } else {
index 7c7f43493c0dfd691cb1b74459d6b0b2fa34ddc2..33a9d7b7813dc5a17eff7b418ac10cc470584f71 100644 (file)
@@ -125,7 +125,7 @@ public class SouthboundMapper {
 
     public static NodeId createNodeId(IpAddress ip, PortNumber port) {
         String uriString = SouthboundConstants.OVSDB_URI_PREFIX + "://"
-                + new String(ip.getValue()) + ":" + port.getValue();
+                + String.valueOf(ip.getValue()) + ":" + port.getValue();
         Uri uri = new Uri(uriString);
         return new NodeId(uri);
     }
index 947dcec1f3d8211f94d7796df07e0985a468745f..d3357053d1e7ebf0738ba3c1753da5d14d7fa69b 100644 (file)
@@ -68,11 +68,8 @@ public class SfcClassifierService extends AbstractServiceInstance implements Con
 
     }
 
-    //private AtomicLong flowCookieInc = new AtomicLong(0x1L);
     private BigInteger getCookie(FlowID flowID) {
-        String cookieString = new String().format("1110%02d%010d", flowID.value, cookieIndex++);
-                //new String().format("1100%02d00%04d", flowID.value, flowCookieInc.getAndIncrement());
-                // "1100%02000000d%04d"
+        String cookieString = String.format("1110%02d%010d", flowID.value, cookieIndex++);
         return new BigInteger(cookieString, 16);
     }
 
index 3ea4608014c0466a82ca6467caf80e3abc31611b..74d90064c9fa9aa9d3aa114e4c60dfe39e9f083a 100644 (file)
@@ -554,7 +554,7 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
                         } else if (tokens[0].equalsIgnoreCase("ptcp")) {
                             ConnectionInfo connectionInfo = ovsdbNodeAugmentation.getConnectionInfo();
                             if (connectionInfo != null && connectionInfo.getLocalIp() != null) {
-                                controllerIpStr = new String(connectionInfo.getLocalIp().getValue());
+                                controllerIpStr = String.valueOf(connectionInfo.getLocalIp().getValue());
                                 controllersStr.add(Constants.OPENFLOW_CONNECTION_PROTOCOL
                                         + ":" + controllerIpStr + ":" + Constants.OPENFLOW_PORT);
                             } else {
index 4786871edff3d167e83549d18e3a067eee0ef875..b2a1ed7d66349316a749b706b11026f1da47ab24 100644 (file)
@@ -159,7 +159,7 @@ public class SouthboundUtil {
         ConnectionInfo connectionInfo = ovsdbNodeAugmentation.getConnectionInfo();
         LOG.info("connectionInfo: {}", connectionInfo);
         if (connectionInfo != null && connectionInfo.getLocalIp() != null) {
-            ipAddr = new String(connectionInfo.getLocalIp().getValue());
+            ipAddr = String.valueOf(connectionInfo.getLocalIp().getValue());
         }
         if (ipAddr == null) {
             ipAddr = getLocalControllerHostIpAddress();
index a6844344e0d697819b2dc9bce3f595e64f256e38..06bc843199afda3537f703222785001a250d2cd4 100644 (file)
@@ -178,7 +178,7 @@ public class SouthboundUtilTest {
         char[] ipAddress = {'0', '.', '0', '.', '0', '.', '0'};
         when(connectionInfo.getLocalIp().getValue()).thenReturn(ipAddress);
         String testTarget = SouthboundConstants.OPENFLOW_CONNECTION_PROTOCOL + ":"
-                + new String(ipAddress) + ":" + SouthboundConstants.DEFAULT_OPENFLOW_PORT;
+                + String.valueOf(ipAddress) + ":" + SouthboundConstants.DEFAULT_OPENFLOW_PORT;
         assertEquals("Incorrect controller IP", testTarget, SouthboundUtil.getControllerTarget(ovsdbNode));
         verify(ovsdbNode).getAugmentation(OvsdbNodeAugmentation.class);
         verify(ovsdbNodeAugmentation).getConnectionInfo();
index f46e15fcf9f969f520b81fcbf377342f0eae010a..4c71b499d782ee5c089dc11c254e0008b0ece38d 100644 (file)
@@ -379,7 +379,8 @@ public class SouthboundIT extends AbstractMdsalTestBase {
     }
 
     private static String connectionInfoToString(final ConnectionInfo connectionInfo) {
-        return new String(connectionInfo.getRemoteIp().getValue()) + ":" + connectionInfo.getRemotePort().getValue();
+        return String.valueOf(
+                connectionInfo.getRemoteIp().getValue()) + ":" + connectionInfo.getRemotePort().getValue();
     }
 
     @Test
@@ -1489,7 +1490,7 @@ public class SouthboundIT extends AbstractMdsalTestBase {
 
     public static NodeId createNodeId(IpAddress ip, PortNumber port) {
         String uriString = SouthboundConstants.OVSDB_URI_PREFIX + "://"
-                + new String(ip.getValue()) + ":" + port.getValue();
+                + String.valueOf(ip.getValue()) + ":" + port.getValue();
         Uri uri = new Uri(uriString);
         return new NodeId(uri);
     }
index 9111acc92e35f5b81e5b8e7873461039f6d52bfa..978c5223b5384d2c8a330abc6c4bc6885742d1e6 100644 (file)
@@ -86,7 +86,7 @@ public class SouthboundUtils {
 
     public NodeId createNodeId(IpAddress ip, PortNumber port) {
         String uriString = SouthboundConstants.OVSDB_URI_PREFIX + "://"
-                + new String(ip.getValue()) + ":" + port.getValue();
+                + String.valueOf(ip.getValue()) + ":" + port.getValue();
         Uri uri = new Uri(uriString);
         return new NodeId(uri);
     }
@@ -168,7 +168,8 @@ public class SouthboundUtils {
     }
 
     public String connectionInfoToString(final ConnectionInfo connectionInfo) {
-        return new String(connectionInfo.getRemoteIp().getValue()) + ":" + connectionInfo.getRemotePort().getValue();
+        return String.valueOf(
+                connectionInfo.getRemoteIp().getValue()) + ":" + connectionInfo.getRemotePort().getValue();
     }
 
     public boolean addOvsdbNode(final ConnectionInfo connectionInfo) {