From 13c9150be6c51b2a9318e0499103ad7183e74017 Mon Sep 17 00:00:00 2001 From: Shashank Kumar Shankar Date: Mon, 5 Feb 2018 11:41:43 -0800 Subject: Fix some Sonar Blocker issues in apihandler/common Some sonar code fixes are done in this patch. https://sonar.onap.org/issues/search#issues=AV3BntKO5bp_wwmIVCLv https://sonar.onap.org/issues/search#issues=AV5mhwQk32hFUzlqebFJ https://sonar.onap.org/issues/search#issues=AV3BntKc5bp_wwmIVCMJ https://sonar.onap.org/issues/search#issues=AV3BntKi5bp_wwmIVCMK https://sonar.onap.org/issues/search#issues=AV3BntKu5bp_wwmIVCMQ https://sonar.onap.org/issues/search#issues=AV3BntK35bp_wwmIVCMX https://sonar.onap.org/issues/search#issues=AV5mhwRN32hFUzlqebFQ https://sonar.onap.org/issues/search#issues=AV3BntLG5bp_wwmIVCMc https://sonar.onap.org/issues/search#issues=AV3BntLR5bp_wwmIVCMh Change-Id: I3ba77adec1951fb7153ed640eb1ea0a4a3ed3e6b Issue-ID: SO-165 Signed-off-by: Shashank Kumar Shankar --- .../mso/apihandler/common/CamundaClient.java | 27 +++++++++------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java') diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java index c8889beb33..b9c0725766 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java @@ -36,6 +36,7 @@ import java.io.IOException; public class CamundaClient extends RequestClient{ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH); + private static final String CAMUNDA_URL_MESAGE = "Camunda url is: "; public CamundaClient() { super(CommonConstants.CAMUNDA); @@ -47,13 +48,13 @@ public class CamundaClient extends RequestClient{ String requestTimeout, String schemaVersion, String serviceInstanceId, String action) throws ClientProtocolException, IOException{ HttpPost post = new HttpPost(url); - msoLogger.debug("Camunda url is: "+ url); + msoLogger.debug(CAMUNDA_URL_MESAGE + url); String jsonReq = wrapRequest(camundaReqXML, requestId, serviceInstanceId, requestTimeout, schemaVersion); StringEntity input = new StringEntity(jsonReq); input.setContentType(CommonConstants.CONTENT_TYPE_JSON); - String encryptedCredentials = null; + String encryptedCredentials; if(props!=null){ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null); if(encryptedCredentials != null){ @@ -65,22 +66,18 @@ public class CamundaClient extends RequestClient{ } post.setEntity(input); - HttpResponse response = client.execute(post); - - return response; + return client.execute(post); } @Override - public HttpResponse post(String jsonReq) - throws ClientProtocolException, IOException{ + public HttpResponse post(String jsonReq) throws ClientProtocolException, IOException{ HttpPost post = new HttpPost(url); - msoLogger.debug("Camunda url is: "+ url); - //String jsonReq = wrapRequest(camundaReqXML, requestId, serviceInstanceId, requestTimeout, schemaVersion); + msoLogger.debug(CAMUNDA_URL_MESAGE + url); StringEntity input = new StringEntity(jsonReq); input.setContentType(CommonConstants.CONTENT_TYPE_JSON); - String encryptedCredentials = null; + String encryptedCredentials; if(props!=null){ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null); if(encryptedCredentials != null){ @@ -92,9 +89,8 @@ public class CamundaClient extends RequestClient{ } post.setEntity(input); - HttpResponse response = client.execute(post); - return response; + return client.execute(post); } @Override @@ -105,7 +101,7 @@ public class CamundaClient extends RequestClient{ String requestDetails) throws ClientProtocolException, IOException{ HttpPost post = new HttpPost(url); - msoLogger.debug("Camunda url is: "+ url); + msoLogger.debug(CAMUNDA_URL_MESAGE + url); String jsonReq = wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction, serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId, serviceType, vnfType, vfModuleType, networkType, requestDetails); @@ -113,7 +109,7 @@ public class CamundaClient extends RequestClient{ StringEntity input = new StringEntity(jsonReq); input.setContentType(CommonConstants.CONTENT_TYPE_JSON); - String encryptedCredentials = null; + String encryptedCredentials; if(props!=null){ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null); if(encryptedCredentials != null){ @@ -125,9 +121,8 @@ public class CamundaClient extends RequestClient{ } post.setEntity(input); - HttpResponse response = client.execute(post); - return response; + return client.execute(post); } @Override -- cgit 1.2.3-korg