summaryrefslogtreecommitdiffstats
path: root/adapters/mso-sdnc-adapter
diff options
context:
space:
mode:
authorrob.bog <r.bogacki@samsung.com>2019-05-28 13:18:24 +0200
committerr.bogacki <r.bogacki@samsung.com>2019-06-03 12:26:59 +0200
commita2df406852f02374c81afc8231639c7cb482f10e (patch)
tree17c234a0b796217b0abb554d291364b400e9b26b /adapters/mso-sdnc-adapter
parent1640ac602723737c8f15a9a84046e709f7230a1c (diff)
Cleaned up duplicated literals
Cleaned up Sonar code smells related to the duplicated literals in loggers. Issue-ID: SO-1932 Signed-off-by: Robert Bogacki <r.bogacki@samsung.com> Change-Id: I58c48cec0012c42b7b892ae76c24c6a087c60c7e
Diffstat (limited to 'adapters/mso-sdnc-adapter')
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java11
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java5
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java13
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java5
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java6
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java36
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java9
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java13
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java15
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java19
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java7
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java5
12 files changed, 81 insertions, 63 deletions
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java
index d48013b80d..b657e7ab26 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java
@@ -30,6 +30,7 @@ import javax.xml.ws.Service;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
+import com.google.common.base.Strings;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -59,19 +60,19 @@ public class SDNCAdapterService extends Service {
try {
wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("main/resources/SDNCAdapter.wsdl");
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL,
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL,
ErrorCode.DataError.getValue(), "Exception - WSDL not found", e);
}
if (wsdlUrl == null) {
- logger.error("{} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL,
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_ADAPTER_WSDL,
ErrorCode.DataError.getValue(), "WSDL not found");
} else {
try {
- logger.info("{} {} {}", MessageEnum.RA_PRINT_URL.toString(), SDNC_ADAPTER_WSDL,
+ logger.info(Strings.repeat("{} ", 3), MessageEnum.RA_PRINT_URL.toString(), SDNC_ADAPTER_WSDL,
wsdlUrl.toURI().toString());
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(), SDNC_ADAPTER_WSDL,
- ErrorCode.DataError.getValue(), "Exception - print URL", e);
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(),
+ SDNC_ADAPTER_WSDL, ErrorCode.DataError.getValue(), "Exception - print URL", e);
}
}
WSDL_LOCATION = wsdlUrl;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java
index 97a6860dfe..c9976686b6 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java
@@ -31,6 +31,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import com.google.common.base.Strings;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -122,8 +123,8 @@ public class SDNCAdapterCallbackRequest {
m.marshal(this, w);
return w.toString();
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.RA_MARSHING_ERROR.toString(), ErrorCode.DataError.getValue(),
- "Exception - MARSHING_ERROR", e);
+ logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_MARSHING_ERROR.toString(),
+ ErrorCode.DataError.getValue(), "Exception - MARSHING_ERROR", e);
}
return "";
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java
index 72d18bd1ce..f19c403861 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java
@@ -29,6 +29,7 @@ import javax.xml.ws.Service;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
+import com.google.common.base.Strings;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -57,18 +58,18 @@ public class SDNCCallbackAdapterService extends Service {
wsdlUrl = Thread.currentThread().getContextClassLoader()
.getResource("main/resources/SDNCCallbackAdapter.wsdl");
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL, "SDNC",
- ErrorCode.DataError.getValue(), "Exception - WSDL not found", e);
+ logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL,
+ "SDNC", ErrorCode.DataError.getValue(), "Exception - WSDL not found", e);
}
if (wsdlUrl == null) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL, "SDNC",
- ErrorCode.DataError.getValue(), "WSDL not found");
+ logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_WSDL_NOT_FOUND.toString(), SDNC_CALLBACK_ADAPTER_WSDL,
+ "SDNC", ErrorCode.DataError.getValue(), "WSDL not found");
} else {
try {
- logger.info("{} {} {} {}", MessageEnum.RA_PRINT_URL.toString(), SDNC_CALLBACK_ADAPTER_WSDL,
+ logger.info(Strings.repeat("{} ", 4), MessageEnum.RA_PRINT_URL.toString(), SDNC_CALLBACK_ADAPTER_WSDL,
wsdlUrl.toURI().toString(), "SDNC");
} catch (Exception e) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(),
+ logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_WSDL_URL_CONVENTION_EXC.toString(),
SDNC_CALLBACK_ADAPTER_WSDL, "SDNC", ErrorCode.DataError.getValue(),
"Exception - URL convention problem", e);
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java
index 2d43385700..d958f8cc7f 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java
@@ -23,6 +23,7 @@
package org.onap.so.adapters.sdnc.impl;
+import com.google.common.base.Strings;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -69,7 +70,7 @@ public class MapRequestTunables {
String[] parts = value.split("\\|"); // escape pipe
if (parts.length < 3) {
- logger.warn("{} {} {} {} {} {}", MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), key, value, "SDNC",
+ logger.warn(Strings.repeat("{} ", 6), MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), key, value, "SDNC",
ErrorCode.DataError.getValue(), "Invalid config");
}
@@ -105,7 +106,7 @@ public class MapRequestTunables {
error = "Missing configuration for:" + key;
}
if (error != null) {
- logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), key, "SDNC",
+ logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), key, "SDNC",
ErrorCode.DataError.getValue(), "Missing config param");
}
logger.debug("RequestTunables Key:{} Value:{} Tunables:{}", key, value, this.toString());
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
index 3e3ec6f9bb..6daaab5abd 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
@@ -25,6 +25,7 @@ package org.onap.so.adapters.sdnc.impl;
import javax.annotation.PostConstruct;
import javax.jws.WebService;
import javax.servlet.http.HttpServletResponse;
+import com.google.common.base.Strings;
import org.onap.so.adapters.sdnc.SDNCAdapterPortType;
import org.onap.so.adapters.sdnc.SDNCAdapterRequest;
import org.onap.so.adapters.sdnc.SDNCAdapterResponse;
@@ -51,7 +52,8 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType {
@PostConstruct
public void init() {
- logger.info("{} {} {}", MessageEnum.RA_INIT_SDNC_ADAPTER.toString(), "SDNC", "SDNCAdapterPortType");
+ logger.info(Strings.repeat("{} ", 3), MessageEnum.RA_INIT_SDNC_ADAPTER.toString(), "SDNC",
+ "SDNCAdapterPortType");
}
/**
@@ -71,7 +73,7 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType {
sdncClient.executeRequest(bpelRequest);
} catch (Exception e) {
String respMsg = "Error sending request to SDNC. Failed to start SDNC Client thread " + e.getMessage();
- logger.error("{} {} {} {}", MessageEnum.RA_SEND_REQUEST_SDNC_ERR.toString(), "SDNC",
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_SEND_REQUEST_SDNC_ERR.toString(), "SDNC",
ErrorCode.DataError.getValue(), respMsg, e);
SDNCResponse sdncResp = new SDNCResponse(bpelReqId);
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
index 7d412b77ad..9c77a38b0b 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
@@ -45,6 +45,7 @@ import javax.xml.ws.handler.MessageContext;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
+import com.google.common.base.Strings;
import org.onap.so.logger.ErrorCode;
import org.onap.so.utils.CryptoUtils;
import org.onap.so.adapters.sdnc.SDNCAdapterRequest;
@@ -89,7 +90,7 @@ public class SDNCRestClient {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
- logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "SDNC",
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "SDNC",
ErrorCode.UnknownError.getValue(), "Exception processing request to SDNC", e);
Thread.currentThread().interrupt();
@@ -176,7 +177,7 @@ public class SDNCRestClient {
logger.info("{} :\n {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.name(), sdncResp.toString(), "SDNC");
return (sdncResp);
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
ErrorCode.BusinessProcesssError.getValue(), "Exception processing request to SDNC", e);
// default
sdncResp.setRespCode(HttpURLConnection.HTTP_INTERNAL_ERROR);
@@ -213,9 +214,10 @@ public class SDNCRestClient {
eType = xpath.evaluate("error-type", error);
sdncErrMsg = new StringBuilder(". SDNC Returned-[error-type:" + eType);
} catch (Exception e3) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(),
- "error-type", error.toString(), "SDNC", ErrorCode.DataError.getValue(),
- EXCEPTION_MSG, e3);
+ logger.error(Strings.repeat("{} ", 6),
+ MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-type",
+ error.toString(), "SDNC", ErrorCode.DataError.getValue(), EXCEPTION_MSG,
+ e3);
}
String eTag = null;
@@ -223,9 +225,10 @@ public class SDNCRestClient {
eTag = xpath.evaluate("error-tag", error);
sdncErrMsg.append(", error-tag:").append(eTag);
} catch (Exception e3) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(),
- "error-tag", error.toString(), "SDNC", ErrorCode.DataError.getValue(),
- EXCEPTION_MSG, e3);
+ logger.error(Strings.repeat("{} ", 6),
+ MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-tag",
+ error.toString(), "SDNC", ErrorCode.DataError.getValue(), EXCEPTION_MSG,
+ e3);
}
String eMsg = null;
@@ -233,18 +236,19 @@ public class SDNCRestClient {
eMsg = xpath.evaluate("error-message", error);
sdncErrMsg.append(", error-message:").append(eMsg).append("]");
} catch (Exception e3) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(),
- "error-message", error.toString(), "SDNC", ErrorCode.DataError.getValue(),
- EXCEPTION_MSG, e3);
+ logger.error(Strings.repeat("{} ", 6),
+ MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-message",
+ error.toString(), "SDNC", ErrorCode.DataError.getValue(), EXCEPTION_MSG,
+ e3);
}
}
} catch (Exception e2) {
- logger.error("{} {} {} {}", MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC",
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC",
ErrorCode.DataError.getValue(), "Exception while analyse error", e2);
}
} // is != null
} catch (Exception e1) {
- logger.error("{} {} {} {}", MessageEnum.RA_ERROR_GET_RESPONSE_SDNC.toString(), "SDNC",
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_ERROR_GET_RESPONSE_SDNC.toString(), "SDNC",
ErrorCode.BusinessProcesssError.getValue(), "Exception while get SDNC response", e1);
}
} // con != null
@@ -256,7 +260,7 @@ public class SDNCRestClient {
sdncResp.setRespMsg(respMsg);
- logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
ErrorCode.AvailabilityError.getValue(), "Exception while communicate with SDNC", e);
return sdncResp;
@@ -282,7 +286,7 @@ public class SDNCRestClient {
try {
wsdlUrl = new URL(bpelUrl);
} catch (MalformedURLException e1) {
- logger.error("{} {} {} {}", MessageEnum.RA_INIT_CALLBACK_WSDL_ERR.toString(), CAMUNDA,
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_INIT_CALLBACK_WSDL_ERR.toString(), CAMUNDA,
ErrorCode.DataError.getValue(), "Exception initializing Callback wsdl", e1);
}
@@ -310,7 +314,7 @@ public class SDNCRestClient {
reqCtx.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
headers.put("Authorization", Collections.singletonList(basicAuth));
} catch (Exception e2) {
- logger.error("{} {} {} {}", MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA,
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA,
ErrorCode.BusinessProcesssError.getValue(),
"Exception - Unable to set authorization in callback request", e2);
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java
index 52164bdac7..f83f0bfede 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java
@@ -31,6 +31,7 @@ import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import com.google.common.base.Strings;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -97,7 +98,7 @@ public class Utils {
return s;
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
ErrorCode.BusinessProcesssError.getValue(), "Exception in genSdncReq", e);
}
return null;
@@ -131,7 +132,7 @@ public class Utils {
return s;
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
ErrorCode.DataError.getValue(), "Exception in genSdncPutReq", e);
}
return null;
@@ -166,7 +167,7 @@ public class Utils {
return s;
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_RESPONSE.toString(), "SDNC",
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_ERROR_CREATE_SDNC_RESPONSE.toString(), "SDNC",
ErrorCode.DataError.getValue(), "Exception in genMsoFailResp", e);
}
return null;
@@ -191,7 +192,7 @@ public class Utils {
s = s.replaceAll("xmlns=\"\"", "");
return s;
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(),
+ logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(),
ErrorCode.DataError.getValue(), "Exception - domToStr", e);
}
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
index 6808230474..1d96e7ae85 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
@@ -25,6 +25,7 @@
package org.onap.so.adapters.sdnc.sdncrest;
import javax.xml.bind.DatatypeConverter;
+import com.google.common.base.Strings;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
@@ -92,8 +93,8 @@ public class BPRestCallback {
public boolean send(String url, String message) {
logger.debug(getClass().getSimpleName() + ".send(" + "url=" + url + " message=" + message + ")");
- logger.info("{} {} {}", MessageEnum.RA_CALLBACK_BPEL.toString(), message == null ? "[no content]" : message,
- CAMUNDA);
+ logger.info(Strings.repeat("{} ", 3), MessageEnum.RA_CALLBACK_BPEL.toString(),
+ message == null ? "[no content]" : message, CAMUNDA);
HttpPost method = null;
HttpResponse httpResponse = null;
@@ -123,7 +124,7 @@ public class BPRestCallback {
method.setHeader(ONAPLogConstants.Headers.INVOCATION_ID, MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID));
method.setHeader(ONAPLogConstants.Headers.PARTNER_NAME, "SO-SDNCAdapter");
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA,
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_SET_CALLBACK_AUTH_EXC.toString(), CAMUNDA,
ErrorCode.BusinessProcesssError.getValue(), "Unable to set authorization in callback request",
e);
error = true;
@@ -141,14 +142,14 @@ public class BPRestCallback {
if (httpResponse.getStatusLine().getStatusCode() >= 300) {
String msg = "Received error response to callback request: " + httpResponse.getStatusLine();
- logger.error("{} {} {} {}", MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA,
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA,
ErrorCode.BusinessProcesssError.getValue(), msg);
}
}
return true;
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA,
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_CALLBACK_BPEL_EXC.toString(), CAMUNDA,
ErrorCode.BusinessProcesssError.getValue(), "Error sending callback request", e);
return false;
} finally {
@@ -168,7 +169,7 @@ public class BPRestCallback {
logger.debug("Exception:", e);
}
}
- logger.info("{} {}", MessageEnum.RA_CALLBACK_BPEL_COMPLETE.toString(), CAMUNDA);
+ logger.info(Strings.repeat("{} ", 2), MessageEnum.RA_CALLBACK_BPEL_COMPLETE.toString(), CAMUNDA);
}
}
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
index 70943c206f..1eabedb185 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
@@ -23,6 +23,7 @@
package org.onap.so.adapters.sdnc.sdncrest;
+import com.google.common.base.Strings;
import org.onap.so.adapters.sdnc.exception.SDNCAdapterException;
import org.onap.so.adapters.sdnc.impl.Constants;
import org.onap.so.logger.ErrorCode;
@@ -54,8 +55,8 @@ public class MapTypedRequestTunablesData {
if ("".equals(value)) {
error = MISSING_CONFIGURATION_ERROR_MSG + reqTunable.getKey();
- logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), reqTunable.getKey(),
- "SDNC", ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG);
+ logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(),
+ reqTunable.getKey(), "SDNC", ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG);
throw new SDNCAdapterException(error);
}
@@ -64,8 +65,8 @@ public class MapTypedRequestTunablesData {
if (parts.length != 5) {
error = "Invalid configuration for: " + reqTunable.getKey();
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), reqTunable.getKey(), value,
- "SDNC", ErrorCode.DataError.getValue(), "Invalid config");
+ logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_SDNC_INVALID_CONFIG.toString(), reqTunable.getKey(),
+ value, "SDNC", ErrorCode.DataError.getValue(), "Invalid config");
throw new SDNCAdapterException(error);
}
@@ -80,7 +81,7 @@ public class MapTypedRequestTunablesData {
if ("".equals(reqTunable.getSdncUrl())) {
error = MISSING_CONFIGURATION_ERROR_MSG + urlPropKey;
- logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), urlPropKey, "SDNC",
+ logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), urlPropKey, "SDNC",
ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG);
throw new SDNCAdapterException(error);
@@ -98,8 +99,8 @@ public class MapTypedRequestTunablesData {
if ("".equals(reqTunable.getMyUrl())) {
error = MISSING_CONFIGURATION_ERROR_MSG + Constants.MY_URL_PROP;
- logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(), Constants.MY_URL_PROP,
- "SDNC", ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG);
+ logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(),
+ Constants.MY_URL_PROP, "SDNC", ErrorCode.DataError.getValue(), MISSING_CONFIG_PARAM_ERROR_MSG);
throw new SDNCAdapterException(error);
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
index a7c65d87a4..c258b72007 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
@@ -34,6 +34,7 @@ import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
+import com.google.common.base.Strings;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
@@ -159,7 +160,8 @@ public abstract class SDNCConnector {
method = null;
- logger.info("{} {} {}", MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), responseContent, "SDNC");
+ logger.info(Strings.repeat("{} ", 3), MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), responseContent,
+ "SDNC");
return createResponseFromContent(statusCode, statusMessage, responseContent, rt);
} catch (SocketTimeoutException | ConnectTimeoutException e) {
@@ -192,12 +194,12 @@ public abstract class SDNCConnector {
}
protected void logError(String errMsg) {
- logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
ErrorCode.AvailabilityError.getValue(), errMsg);
}
protected void logError(String errMsg, Throwable t) {
- logger.error("{} {} {} {}", MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC.toString(), "SDNC",
ErrorCode.AvailabilityError.getValue(), errMsg, t);
}
@@ -283,7 +285,7 @@ public abstract class SDNCConnector {
String errorType = xpath.evaluate("error-type", error);
info += "error-type:" + errorType;
} catch (XPathExpressionException e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-type",
+ logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-type",
error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
}
@@ -294,7 +296,7 @@ public abstract class SDNCConnector {
}
info += "error-tag:" + errorTag;
} catch (XPathExpressionException e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-tag",
+ logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-tag",
error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
}
@@ -305,8 +307,9 @@ public abstract class SDNCConnector {
}
info += "error-message:" + errorMessage;
} catch (Exception e) {
- logger.error("{} {} {} {} {} {}", MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(), "error-message",
- error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION, e);
+ logger.error(Strings.repeat("{} ", 6), MessageEnum.RA_EVALUATE_XPATH_ERROR.toString(),
+ "error-message", error.toString(), "SDNC", ErrorCode.DataError.getValue(), XPATH_EXCEPTION,
+ e);
}
if (!info.isEmpty()) {
@@ -318,7 +321,7 @@ public abstract class SDNCConnector {
}
}
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC",
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_ANALYZE_ERROR_EXC.toString(), "SDNC",
ErrorCode.DataError.getValue(), "Exception while analyzing errors", e);
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
index 7e82adf064..022fb7bf89 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
@@ -31,6 +31,7 @@ import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import com.google.common.base.Strings;
import org.apache.http.HttpStatus;
import org.onap.so.adapters.sdnc.exception.SDNCAdapterException;
import org.onap.so.adapters.sdncrest.RequestInformation;
@@ -185,7 +186,7 @@ public class SDNCServiceRequestTask {
addTextChild(agnosticServiceInformation, "content-type", contentType);
addTextChild(agnosticServiceInformation, "anydata", anydata);
} catch (Exception e) {
- logger.error("{} {} {} {}", MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
+ logger.error(Strings.repeat("{} ", 4), MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
ErrorCode.BusinessProcesssError.getValue(), "Exception in genSdncReq", e);
return null;
}
@@ -204,8 +205,8 @@ public class SDNCServiceRequestTask {
transformer.transform(new DOMSource(doc), new StreamResult(writer));
xml = writer.toString();
} catch (Exception e) {
- logger.error("{} {} {}", MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(), ErrorCode.DataError.getValue(),
- "Exception - domToStr", e);
+ logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_ERROR_CONVERT_XML2STR.toString(),
+ ErrorCode.DataError.getValue(), "Exception - domToStr", e);
return null;
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
index 3921891ced..31187c568f 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
@@ -31,6 +31,7 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import com.google.common.base.Strings;
import org.onap.so.adapters.sdnc.impl.Constants;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
@@ -61,14 +62,14 @@ public class SNIROResponse {
@Consumes("*/*")
@Produces({MediaType.TEXT_PLAIN})
public Response serviceNotification(@PathParam("correlator") String correlator, String content) {
- logger.info("{} {} {} {}", MessageEnum.RA_RECEIVE_SDNC_NOTIF.toString(), content, "SDNC",
+ logger.info(Strings.repeat("{} ", 4), MessageEnum.RA_RECEIVE_SDNC_NOTIF.toString(), content, "SDNC",
"SDNCNotify/SNIROResponse");
String bpUrl = env.getProperty(Constants.BPEL_REST_URL_PROP, "");
if (bpUrl == null || ("").equals(bpUrl)) {
String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP;
- logger.error("{} {} {} {} {}", MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(),
+ logger.error(Strings.repeat("{} ", 5), MessageEnum.RA_SDNC_MISS_CONFIG_PARAM.toString(),
Constants.BPEL_REST_URL_PROP, "SDNC", ErrorCode.DataError.getValue(), "Missing config param");
return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(error).build();