aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMunir Ahmad <munir.ahmad@bell.ca>2018-02-24 12:53:14 -0500
committerSeshu Kumar M <seshu.kumar.m@huawei.com>2018-03-07 09:33:59 +0000
commit51b69b3ac37bbad99accf0fa95ef8c101dcc44c4 (patch)
tree8c857f7e5fd9581a01b5a4731ac0b9c3a1800c61
parent5c45d1883426687d9a53dafc8e17f470aa661857 (diff)
Remove unnecessary String constructor call
Change-Id: Ibb0dcc412ae6243ee370b8e272455269303130eb Issue-ID: SO-437 Signed-off-by: Munir Ahmad <munir.ahmad@bell.ca>
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java4
-rw-r--r--common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryTest.java4
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java9
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java6
5 files changed, 15 insertions, 10 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java
index 124e2c3a28..f54eba406e 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java
@@ -42,7 +42,7 @@ public class DMaaPRestClient extends RestClient {
@Override
protected void initializeHeaderMap(Map<String, String> headerMap) {
- headerMap.put("Authorization", "Basic " + Base64.getEncoder().encodeToString(new String(username + ":" + password).getBytes()));
+ headerMap.put("Authorization", "Basic " + Base64.getEncoder().encodeToString((username + ":" + password).getBytes()));
}
@Override
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
index 54bd8cda61..38a44ab1f6 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
@@ -150,7 +150,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
private String getPostStringBody(ResourceOperationStatus resourceOperationStatus) {
logger.info("AbstractSdncOperationTask.getPostStringBody begin!");
- String postBody = new String(postBodyTemplate);
+ String postBody = postBodyTemplate;
postBody = postBody.replace("$errorCode", resourceOperationStatus.getErrorCode());
postBody = postBody.replace("$jobId", resourceOperationStatus.getJobId());
postBody = postBody.replace("$operType", resourceOperationStatus.getOperType());
@@ -166,7 +166,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
private String getGetStringBody(String serviceId, String operationId, String resourceTemplateUUID) {
logger.info("AbstractSdncOperationTask.getGetStringBody begin!");
- String getBody = new String(getBodyTemplate);
+ String getBody = getBodyTemplate;
getBody = getBody.replace("$operationId", operationId);
getBody = getBody.replace("$resourceTemplateUUID", resourceTemplateUUID);
getBody = getBody.replace("$serviceId", serviceId);
diff --git a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryTest.java b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryTest.java
index 7b559dfbcb..db58c5a49e 100644
--- a/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryTest.java
+++ b/common/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoPropertiesFactoryTest.java
@@ -598,8 +598,8 @@ public class MsoPropertiesFactoryTest {
assertFalse(msoProperties.equals(msoProperties2));
assertTrue(msoProperties.equals(msoProperties));
assertFalse(msoProperties.equals(null));
- assertFalse(msoProperties.equals(new String()));
-
+ assertFalse(msoProperties.toString().isEmpty());
+
// Test a reload with timer set to 1 in PATH_MSO_JSON_PROP2
msoPropertiesFactory.changeMsoPropertiesFilePath(MSO_JSON_PROP_ID, PATH_MSO_JSON_PROP);
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 371d3162de..9258cabe5b 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
@@ -60,7 +60,8 @@ public class CamundaClient extends RequestClient{
if(encryptedCredentials != null){
String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
if(userCredentials != null){
- post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ post.addHeader("Authorization", "Basic " + DatatypeConverter
+ .printBase64Binary(userCredentials.getBytes()));
}
}
}
@@ -83,7 +84,8 @@ public class CamundaClient extends RequestClient{
if(encryptedCredentials != null){
String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
if(userCredentials != null){
- post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ post.addHeader("Authorization", "Basic " + DatatypeConverter
+ .printBase64Binary(userCredentials.getBytes()));
}
}
}
@@ -115,7 +117,8 @@ public class CamundaClient extends RequestClient{
if(encryptedCredentials != null){
String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
if(userCredentials != null){
- post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ post.addHeader("Authorization", "Basic " + DatatypeConverter
+ .printBase64Binary(userCredentials.getBytes()));
}
}
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java
index 364169d4c1..4b179daa7c 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java
@@ -52,7 +52,8 @@ public class CamundaTaskClient extends RequestClient{
if(encryptedCredentials != null){
String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
if(userCredentials != null){
- post.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ post.addHeader("Authorization", "Basic " + DatatypeConverter
+ .printBase64Binary(userCredentials.getBytes()));
}
}
}
@@ -90,7 +91,8 @@ public class CamundaTaskClient extends RequestClient{
if(encryptedCredentials != null){
String userCredentials = getEncryptedPropValue(encryptedCredentials, CommonConstants.DEFAULT_BPEL_AUTH, CommonConstants.ENCRYPTION_KEY);
if(userCredentials != null){
- get.addHeader("Authorization", "Basic " + new String(DatatypeConverter.printBase64Binary(userCredentials.getBytes())));
+ get.addHeader("Authorization", "Basic " + DatatypeConverter
+ .printBase64Binary(userCredentials.getBytes()));
}
}
}