aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src/main/java
diff options
context:
space:
mode:
authorr.bogacki <r.bogacki@samsung.com>2019-05-06 09:25:02 +0200
committerr.bogacki <r.bogacki@samsung.com>2019-05-06 11:27:59 +0200
commit8202525d2e4ede3754b1b48c560bce8493aff281 (patch)
tree4fe4088ee8b2666f43a3ff2057903fee92e8b749 /bpmn/MSOCommonBPMN/src/main/java
parent75ba5d258a64da22adb6b070199d4920118614ee (diff)
Fixed NPE in ResourceRequestBuilder
Fixed possible NullPointerException in ResourceRequestBuilder according to the Sonar analysis. Change-Id: Ide97a1a6439342ef55fc490916c945d194d4e518 Issue-ID: SO-1498 Signed-off-by: Robert Bogacki <r.bogacki@samsung.com>
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main/java')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
index 58f775ce0b..0df25be714 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
@@ -151,7 +151,7 @@ public class ResourceRequestBuilder {
Map<String, String> resourceInputData = getResourceInputStr(serviceVnfCust, resourceCustomizationUuid);
// find match in network resource
- if (resourceInputData.size() == 0) {
+ if (resourceInputData != null && resourceInputData.isEmpty()) {
List<Map<String, Object>> serviceNetworkCust =
(List<Map<String, Object>>) serviceResources.get("serviceNetworks");
resourceInputData = getResourceInputStr(serviceNetworkCust, resourceCustomizationUuid);
@@ -164,15 +164,19 @@ public class ResourceRequestBuilder {
}
}
- String resourceInputStr = resourceInputData.get("resourceInput");
- ResourceLevel resourceLevel = ResourceLevel.valueOf(resourceInputData.get("nodeType"));
+ String resourceInputStr = null;
+ ResourceLevel resourceLevel = null;
+ if (resourceInputData != null) {
+ resourceInputStr = resourceInputData.get("resourceInput");
+ resourceLevel = ResourceLevel.valueOf(resourceInputData.get("nodeType"));
+ }
- if (resourceInputStr != null && !resourceInputStr.isEmpty()) {
+ if (resourceInputStr != null && !resourceInputStr.isEmpty() && resourceLevel != null) {
return getResourceInput(resourceInputStr, serviceInputs, resourceLevel, currentVFData);
}
} catch (Exception e) {
- logger.error("not able to retrieve service instance");
+ logger.error("not able to retrieve service instance", e);
}
return new HashMap();
}