diff options
author | Yulian Han <elaine.hanyulian@huawei.com> | 2018-04-19 11:16:14 +0800 |
---|---|---|
committer | Yulian Han <elaine.hanyulian@huawei.com> | 2018-04-19 11:28:07 +0000 |
commit | eac033b710f044bb1eee033527fed61df8001615 (patch) | |
tree | 1c498d7609deb34e346f697429b25f7e4a4e0517 /bpmn/MSOInfrastructureBPMN/src | |
parent | e75e31d0d63c3ef9f63f1d81edcef0e47ad8123a (diff) |
avoid null exception
Change-Id: Idaa55084f5ecb0dd3636c232cebc14fa5f064304
Issue-ID: SO-578
Signed-off-by: Yulian Han <elaine.hanyulian@huawei.com>
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src')
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); } |