diff options
author | Chuanyu Chen <chenchuanyu@huawei.com> | 2018-04-20 01:50:33 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-04-20 01:50:33 +0000 |
commit | ebd7de2772445e6c9a486ea801728860b88dfe43 (patch) | |
tree | cfb80c0549c6d4303f2e7cd846523ee74ed2ed3c | |
parent | c48052c5351b3e7982ca2d82032b693b3e9f663d (diff) | |
parent | eac033b710f044bb1eee033527fed61df8001615 (diff) |
Merge "avoid null exception"
2 files changed, 7 insertions, 7 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java index de50fe11b5..09561a620e 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java @@ -110,7 +110,7 @@ public abstract class AbstractBuilder<IN, OUT> { protected String getRequestActoin(DelegateExecution execution) { String action = /*RequestInformation.*/RequestAction.CreateNetworkInstance.getName(); String operType = (String) execution.getVariable(OPERATION_TYPE); - String resourceType = ((String) execution.getVariable(RESOURCE_TYPE)).toLowerCase(); + String resourceType = (String)execution.getVariable(RESOURCE_TYPE); if (!StringUtils.isBlank(operType)) { if (RequestsDbConstant.OperationType.DELETE.equalsIgnoreCase(operType)) { if (isOverlay(resourceType)) { @@ -134,17 +134,17 @@ public abstract class AbstractBuilder<IN, OUT> { } private boolean isOverlay(String resourceType) { - return !StringUtils.isBlank(resourceType) && resourceType.contains("overlay"); + return !StringUtils.isBlank(resourceType) && resourceType.toLowerCase().contains("overlay"); } private boolean isUnderlay(String resourceType) { - return !StringUtils.isBlank(resourceType) && resourceType.contains("underlay"); + return !StringUtils.isBlank(resourceType) && resourceType.toLowerCase().contains("underlay"); } protected String getSvcAction(DelegateExecution execution) { String action = /*SdncRequestHeader.*/SvcAction.Create.getName(); String operType = (String) execution.getVariable(OPERATION_TYPE); - String resourceType = ((String) execution.getVariable(RESOURCE_TYPE)).toLowerCase(); + String resourceType = (String)execution.getVariable(RESOURCE_TYPE); if (!StringUtils.isBlank(operType)) { if (RequestsDbConstant.OperationType.DELETE.equalsIgnoreCase(operType)) { if (isOverlay(resourceType)) { diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java index e2ec7e062f..99a87def80 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java @@ -310,12 +310,12 @@ public class AbstractBuilderTest { abstractBuilder.build(null, null); } - @Test(expected = NullPointerException.class) + @Test public void getRequestActoinTest() throws Exception { abstractBuilder.getRequestActoin(delegateExecution); } - @Test(expected = NullPointerException.class) + @Test public void getSvcActionTest() throws Exception { abstractBuilder.getSvcAction(delegateExecution); } @@ -340,7 +340,7 @@ public class AbstractBuilderTest { abstractBuilder.getParamEntities(new HashMap<>()); } - @Test(expected = NullPointerException.class) + @Test public void getRequestInformationEntityTest() throws Exception { abstractBuilder.getRequestInformationEntity(delegateExecution); } |