aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsurya-huawei <a.u.surya@huawei.com>2017-09-20 12:22:35 +0530
committersurya-huawei <a.u.surya@huawei.com>2017-09-20 12:24:31 +0530
commitd1ed09daa141268d0cb830f5060e9463719d1eba (patch)
treeddc2ac3f81ce197451af9d50fe2b9e564b9b7fdb
parentfa58685070866ca95774779d0a5bc593c9a5800b (diff)
Fix Sonar Issue in sli/adaptors module
One blocker issue *Checking for a null dereferencing This is to avoid NullPointerException Issue-Id: CCSDK-87 Change-Id: Ie2192636e3ad8dfa9643cac61b3086c3cd33f126 Signed-off-by: surya-huawei <a.u.surya@huawei.com>
-rw-r--r--resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java18
1 files changed, 10 insertions, 8 deletions
diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java
index 7db37fff..58f10365 100644
--- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java
+++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java
@@ -331,14 +331,16 @@ public class ResourceDaoImpl implements ResourceDao {
ai = rai;
}
- ai.resourceType = r.resourceType;
- ai.resourceKey = r.resourceKey;
- ai.resourceSetId = aiEntity.resourceSetId;
- ai.resourceUnionId = aiEntity.resourceUnionId;
- if (aiEntity.resourceShareGroupList != null)
- ai.resourceShareGroupList = new HashSet<String>(StrUtil.listStr(aiEntity.resourceShareGroupList));
- ai.applicationId = aiEntity.applicationId;
- ai.allocationTime = aiEntity.allocationTime;
+ if (ai!=null) {
+ ai.resourceType = r.resourceType;
+ ai.resourceKey = r.resourceKey;
+ ai.resourceSetId = aiEntity.resourceSetId;
+ ai.resourceUnionId = aiEntity.resourceUnionId;
+ if (aiEntity.resourceShareGroupList != null)
+ ai.resourceShareGroupList = new HashSet<String>(StrUtil.listStr(aiEntity.resourceShareGroupList));
+ ai.applicationId = aiEntity.applicationId;
+ ai.allocationTime = aiEntity.allocationTime;
+ }
return ai;
}