From 18b29b863206deeba869fcd2738ea8ffce20b962 Mon Sep 17 00:00:00 2001 From: Munir Ahmad Date: Wed, 21 Feb 2018 16:44:58 -0500 Subject: Swap String concatenation with StringBuilder Change-Id: I5c43d3267e5f75623bcc837e27c57a6ad6aa8877 Issue-ID: SO-437 Signed-off-by: Munir Ahmad --- .../java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java | 8 ++++---- .../org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'adapters/mso-sdnc-adapter/src/main') 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 97f30bea6b..45d5944c7d 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 @@ -197,7 +197,7 @@ public class SDNCRestClient implements Runnable { //default sdncResp.setRespCode(HttpURLConnection.HTTP_INTERNAL_ERROR); String respMsg = "Error processing request to SDNC. "; - String sdncErrMsg = ""; + StringBuilder sdncErrMsg = new StringBuilder(); if (e instanceof java.net.SocketTimeoutException ) { @@ -229,7 +229,7 @@ public class SDNCRestClient implements Runnable { String eType = null; try { eType = xpath.evaluate("error-type", error); - sdncErrMsg = ". SDNC Returned-[error-type:" + eType; + sdncErrMsg = new StringBuilder(". SDNC Returned-[error-type:" + eType); } catch (Exception e3) { msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-type", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while evaluate xpath", e3); } @@ -237,7 +237,7 @@ public class SDNCRestClient implements Runnable { String eTag = null; try { eTag = xpath.evaluate( "error-tag", error); - sdncErrMsg = sdncErrMsg + ", error-tag:" + eTag; + sdncErrMsg.append(", error-tag:").append(eTag); } catch (Exception e3) { msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-tag", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while evaluate xpath", e3); } @@ -245,7 +245,7 @@ public class SDNCRestClient implements Runnable { String eMsg = null; try { eMsg = xpath.evaluate("error-message", error); - sdncErrMsg = sdncErrMsg + ", error-message:" + eMsg + "]"; + sdncErrMsg.append(", error-message:").append(eMsg).append("]"); } catch (Exception e3) { msoLogger.error (MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-message", error.toString(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception while evaluate xpath", e3); } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java index 262d23bd09..be0466af73 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java @@ -257,7 +257,7 @@ public abstract class SDNCConnector { // // - String output = null; + StringBuilder output = null; try { XPathFactory xpathFactory = XPathFactory.newInstance(); @@ -306,9 +306,9 @@ public abstract class SDNCConnector { if (!info.isEmpty()) { if (output == null) { - output = "[" + info + "]"; + output = new StringBuilder("[" + info + "]"); } else { - output += " [" + info + "]"; + output.append(" [").append(info).append("]"); } } } @@ -317,6 +317,6 @@ public abstract class SDNCConnector { MsoLogger.ErrorCode.DataError, "Exception while analyzing errors", e); } - return output; + return output.toString(); } } -- cgit 1.2.3-korg