summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2021-03-24 10:33:13 -0400
committerDan Timoney <dtimoney@att.com>2021-03-24 10:33:13 -0400
commit60b8216bd4461eee98d1758b34a94cd96d665562 (patch)
tree0206a93a54f5e19db1b7a4a731185ec89a5d6c3a
parent691b03daf5957d576209e5341597b28c20fd4818 (diff)
Fix null pointer exception
Fix null pointer exception in case of empty list Issue-ID: CCSDK-3237 Signed-off-by: Dan Timoney <dtimoney@att.com> Change-Id: Ic94d60bf7a52c23507ecc2402f9be9b580f2ea5b
-rwxr-xr-xcore/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java b/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
index 94e1425cb..ce8253a5c 100755
--- a/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
+++ b/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
@@ -299,7 +299,10 @@ public class MdsalHelper {
if (!isAccessible) {
m.setAccessible(true);
}
- Object retList = Map.class.isAssignableFrom(returnType)?new ArrayList(((Map) m.invoke(fromObj)).values()):m.invoke(fromObj);
+ Object retList = m.invoke(fromObj);
+ if ((retList != null) && Map.class.isAssignableFrom(returnType)) {
+ retList = new ArrayList(((Map)retList).values());
+ }
//due duplicated getters with Map and List(deprecated) stop if already mapped
if(!hasAlreadyKeys(props,propNamePfx + "." + fieldName)) {