From 1beaa908abebcb3d0f5a8ac7e80e3604d5b9f638 Mon Sep 17 00:00:00 2001 From: Munir Ahmad Date: Sat, 24 Feb 2018 12:34:32 -0500 Subject: Swap StringBuffer with StringBuilder everywhere Change-Id: Ia1f8d3ebc4026179bf08cdb0bd71c4480b8481df Issue-ID: SO-437 Signed-off-by: Munir Ahmad --- .../openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java | 2 +- .../openecomp/mso/asdc/client/ASDCGlobalController.java | 2 +- .../openecomp/mso/asdc/installer/ASDCElementInfo.java | 2 +- .../openecomp/mso/asdc/installer/BigDecimalVersion.java | 2 +- .../mso/asdc/installer/heat/ToscaResourceInstaller.java | 2 +- .../mso/asdc/installer/heat/VfResourceInstaller.java | 2 +- .../openecomp/mso/asdc/util/ASDCNotificationLogging.java | 16 ++++++++-------- .../org/openecomp/mso/asdc/util/NotificationLogging.java | 2 +- .../org/openecomp/mso/bpmn/common/util/CryptoUtils.java | 2 +- .../org/openecomp/mso/bpmn/core/HealthCheckHandler.java | 4 ++-- .../mso/bpmn/core/domain/ServiceDecomposition.java | 2 +- .../java/org/openecomp/mso/bpmn/core/json/JsonUtils.java | 2 +- .../org/openecomp/mso/properties/MsoJsonProperties.java | 2 +- .../main/java/org/openecomp/mso/utils/CryptoUtils.java | 2 +- .../db/catalog/beans/AllottedResourceCustomization.java | 2 +- .../org/openecomp/mso/db/catalog/beans/VfModule.java | 2 +- .../mso/db/catalog/beans/VnfComponentsRecipe.java | 2 +- .../org/openecomp/mso/db/catalog/beans/VnfRecipe.java | 2 +- .../org/openecomp/mso/db/catalog/beans/VnfResource.java | 2 +- 19 files changed, 27 insertions(+), 27 deletions(-) diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java index 45d5944c7d..55a2156c50 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java @@ -142,7 +142,7 @@ public class SDNCRestClient implements Runnable { DataOutputStream out = null; BufferedReader in = null; SDNCResponse sdncResp = new SDNCResponse(rt.getReqId()); - StringBuffer response = new StringBuffer(); + StringBuilder response = new StringBuilder(); msoLogger.info(MessageEnum.RA_SEND_REQUEST_SDNC, rt.toString(), "SDNC", ""); msoLogger.debug("SDNC Request Body:\n" + sdncReqBody); diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCGlobalController.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCGlobalController.java index c0056e0573..251888e9e2 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCGlobalController.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCGlobalController.java @@ -49,7 +49,7 @@ public class ASDCGlobalController { List controllerNames = ASDCConfiguration.getAllDefinedControllers(); - StringBuffer controllerListLog = new StringBuffer("List of controllers loaded:"); + StringBuilder controllerListLog = new StringBuilder("List of controllers loaded:"); for (String controllerName : controllerNames) { controllers.put(controllerName, new ASDCController(controllerName)); controllerListLog.append(controllerName); diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/ASDCElementInfo.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/ASDCElementInfo.java index 3c262c6c90..29144a9884 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/ASDCElementInfo.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/ASDCElementInfo.java @@ -109,7 +109,7 @@ public class ASDCElementInfo { */ @Override public final String toString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); List aggregatedElements = new ArrayList<>(); for (Entry entry : this.getElementInfoMap().entrySet()) { aggregatedElements.add(entry.getKey() + ": " + entry.getValue()); diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/BigDecimalVersion.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/BigDecimalVersion.java index 5547bb1189..c2faf1c0e8 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/BigDecimalVersion.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/BigDecimalVersion.java @@ -34,7 +34,7 @@ public class BigDecimalVersion { public static BigDecimal castAndCheckNotificationVersion(String version) { // Truncate the version if bad type String[] splitVersion = version.split("\\."); - StringBuffer newVersion = new StringBuffer(); + StringBuilder newVersion = new StringBuilder(); if (splitVersion.length > 1) { newVersion.append(splitVersion[0]); newVersion.append("."); diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java index b998be9a69..f22debce1e 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java @@ -636,7 +636,7 @@ public class ToscaResourceInstaller {// implements IVfResourceInstaller { return body; } - StringBuffer sb = new StringBuffer(body.length()); + StringBuilder sb = new StringBuilder(body.length()); int currentIndex = 0; int startIndex = 0; diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/VfResourceInstaller.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/VfResourceInstaller.java index bd20eb0bf1..0ae58dad41 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/VfResourceInstaller.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/VfResourceInstaller.java @@ -631,7 +631,7 @@ public class VfResourceInstaller implements IVfResourceInstaller { return body; } - StringBuffer sb = new StringBuffer(body.length()); + StringBuilder sb = new StringBuilder(body.length()); int currentIndex = 0; int startIndex = 0; diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java index 28f5dbdee5..a7ba01354d 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java @@ -42,7 +42,7 @@ public class ASDCNotificationLogging { if (asdcNotification == null) { return "NULL"; } - StringBuffer buffer = new StringBuffer("ASDC Notification:"); + StringBuilder buffer = new StringBuilder("ASDC Notification:"); buffer.append(System.lineSeparator()); buffer.append("DistributionID:"); @@ -96,7 +96,7 @@ public class ASDCNotificationLogging { } - StringBuffer buffer = new StringBuffer("CSAR Notification:"); + StringBuilder buffer = new StringBuilder("CSAR Notification:"); buffer.append(System.lineSeparator()); buffer.append(System.lineSeparator()); @@ -286,7 +286,7 @@ public class ASDCNotificationLogging { return null; } - StringBuffer buffer = new StringBuffer("VfModuleMetaData List:"); + StringBuilder buffer = new StringBuilder("VfModuleMetaData List:"); buffer.append(System.lineSeparator()); buffer.append("{"); @@ -311,7 +311,7 @@ public class ASDCNotificationLogging { return "NULL"; } - StringBuffer buffer = new StringBuffer("VfModuleMetaData:"); + StringBuilder buffer = new StringBuilder("VfModuleMetaData:"); buffer.append(System.lineSeparator()); buffer.append("VfModuleModelName:"); @@ -395,7 +395,7 @@ public class ASDCNotificationLogging { return null; } - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); buffer.append("{"); for (IResourceInstance resourceInstanceElem:asdcNotification.getResources()) { @@ -418,7 +418,7 @@ public class ASDCNotificationLogging { return null; } - StringBuffer buffer = new StringBuffer("Resource Instance Info:"); + StringBuilder buffer = new StringBuilder("Resource Instance Info:"); buffer.append(System.lineSeparator()); buffer.append("ResourceInstanceName:"); @@ -473,7 +473,7 @@ public class ASDCNotificationLogging { return null; } - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); buffer.append("{"); for (IArtifactInfo artifactInfoElem:artifactsList) { buffer.append(System.lineSeparator()); @@ -495,7 +495,7 @@ public class ASDCNotificationLogging { return null; } - StringBuffer buffer = new StringBuffer("Service Artifacts Info:"); + StringBuilder buffer = new StringBuilder("Service Artifacts Info:"); buffer.append(System.lineSeparator()); buffer.append("ArtifactName:"); diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/NotificationLogging.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/NotificationLogging.java index 9b38a50daf..126114d2d6 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/NotificationLogging.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/NotificationLogging.java @@ -82,7 +82,7 @@ public class NotificationLogging implements InvocationHandler { return "EMPTY"; // No declared methods in this class !!! } - StringBuffer buffer = new StringBuffer("ASDC Notification:"); + StringBuilder buffer = new StringBuilder("ASDC Notification:"); buffer.append(System.lineSeparator()); for (Method m : declaredMethods) { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java index 8d2b33cde6..5972c76c41 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java @@ -75,7 +75,7 @@ public class CryptoUtils { private static String byteArrayToHexString(byte[] b){ - StringBuffer sb = new StringBuffer(b.length * 2); + StringBuilder sb = new StringBuilder(b.length * 2); for (byte aB : b) { int v = aB & 0xff; if (v < 16) { diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java index 204d9e4e5e..584ccda1ac 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java @@ -238,7 +238,7 @@ public class HealthCheckHandler { BPMNLogger.debug(healthcheckDebugEnabled, "Post url is: " + url); //now create a soap request message as follows: - final StringBuffer payload = new StringBuffer(); + final StringBuilder payload = new StringBuilder(); payload.append("\n"); payload.append("\n"); payload.append("\n"); @@ -270,7 +270,7 @@ public class HealthCheckHandler { BufferedReader rd = new BufferedReader( new InputStreamReader(response.getEntity().getContent())); - StringBuffer result = new StringBuffer(); + StringBuilder result = new StringBuilder(); String line = ""; while ((line = rd.readLine()) != null) { result.append(line); diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java index 0e985cc8f1..f5283f4579 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ServiceDecomposition.java @@ -150,7 +150,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable { */ @JsonIgnore public String getServiceResourcesJsonString(){ - StringBuffer serviceResourcesJsonStringBuffer = new StringBuffer(); + StringBuilder serviceResourcesJsonStringBuffer = new StringBuilder(); serviceResourcesJsonStringBuffer.append(listToJson((this.getServiceNetworks()))); serviceResourcesJsonStringBuffer.append(listToJson((this.getServiceVnfs()))); serviceResourcesJsonStringBuffer.append(listToJson((this.getServiceAllottedResources()))); diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java index 640dc697a2..b47d73f665 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java @@ -122,7 +122,7 @@ public class JsonUtils { * @return String containing the XML translation */ public static String toXMLString(Object obj, String tagName) throws JSONException { - StringBuffer strBuf = new StringBuffer(); + StringBuilder strBuf = new StringBuilder(); int i; JSONArray jsonArr; JSONObject jsonObj; diff --git a/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java b/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java index c0997f31d9..cf69e1c5a7 100644 --- a/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java +++ b/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java @@ -159,7 +159,7 @@ public class MsoJsonProperties extends AbstractMsoProperties { @Override public String toString() { - StringBuffer response = new StringBuffer(); + StringBuilder response = new StringBuilder(); response.append("Config file " + propertiesFileName + "(Timer:" + automaticRefreshInMinutes + "mins):" + System.getProperty("line.separator")); response.append(this.jsonRootNode.toString()); diff --git a/common/src/main/java/org/openecomp/mso/utils/CryptoUtils.java b/common/src/main/java/org/openecomp/mso/utils/CryptoUtils.java index 55fe69bb9a..5d0ff5b79e 100644 --- a/common/src/main/java/org/openecomp/mso/utils/CryptoUtils.java +++ b/common/src/main/java/org/openecomp/mso/utils/CryptoUtils.java @@ -72,7 +72,7 @@ public final class CryptoUtils { } public static String byteArrayToHexString (byte[] b) { - StringBuffer sb = new StringBuffer (b.length * 2); + StringBuilder sb = new StringBuilder(b.length * 2); for (byte aB : b) { int v = aB & 0xff; if (v < 16) { diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomization.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomization.java index 66db7dfdec..daeefcce02 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomization.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomization.java @@ -131,7 +131,7 @@ public class AllottedResourceCustomization extends MavenLikeVersioning implement @Override public String toString () { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append("modelCustomizationUuid="); sb.append(this.modelCustomizationUuid); sb.append(",modelInstanceName="); diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModule.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModule.java index fd2b6ff37b..cd2821a7b0 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModule.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModule.java @@ -142,7 +142,7 @@ public class VfModule extends MavenLikeVersioning implements Serializable { @Override public String toString () { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append("VFModule:"); buf.append("modelName="); diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipe.java index 1e5f69c622..42d6b82f0f 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipe.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfComponentsRecipe.java @@ -64,7 +64,7 @@ public class VnfComponentsRecipe extends Recipe implements Serializable { @Override public String toString () { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append (",vnfComponentParamXSD=" + vnfComponentParamXSD); sb.append (",serviceType=" + getServiceType ()); diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfRecipe.java index 55bb33a4ef..29e4b8909c 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfRecipe.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfRecipe.java @@ -56,7 +56,7 @@ public class VnfRecipe extends Recipe implements Serializable { @Override public String toString () { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append (",vnfParamXSD=" + vnfParamXSD); sb.append (",serviceType=" + getServiceType ()); diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResource.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResource.java index 7495015cb9..37040d6a4e 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResource.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResource.java @@ -240,7 +240,7 @@ public class VnfResource extends MavenLikeVersioning implements Serializable { @Override public String toString () { - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); buf.append("VNF="); buf.append(",modelVersion="); -- cgit 1.2.3-korg