diff options
author | Munir Ahmad <munir.ahmad@bell.ca> | 2018-02-21 16:44:58 -0500 |
---|---|---|
committer | Munir Ahmad <munir.ahmad@bell.ca> | 2018-02-21 16:46:08 -0500 |
commit | 18b29b863206deeba869fcd2738ea8ffce20b962 (patch) | |
tree | 30f21d8824c892747978a72179302d6b451185f1 /adapters/mso-sdnc-adapter/src/main/java/org | |
parent | f5b9e7cda13e239024335a3f9b08bfc9a4ec9fca (diff) |
Swap String concatenation with StringBuilder
Change-Id: I5c43d3267e5f75623bcc837e27c57a6ad6aa8877
Issue-ID: SO-437
Signed-off-by: Munir Ahmad <munir.ahmad@bell.ca>
Diffstat (limited to 'adapters/mso-sdnc-adapter/src/main/java/org')
2 files changed, 8 insertions, 8 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 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 { // </error> // </errors> - 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(); } } |