From 60b8216bd4461eee98d1758b34a94cd96d665562 Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Wed, 24 Mar 2021 10:33:13 -0400 Subject: Fix null pointer exception Fix null pointer exception in case of empty list Issue-ID: CCSDK-3237 Signed-off-by: Dan Timoney Change-Id: Ic94d60bf7a52c23507ecc2402f9be9b580f2ea5b --- .../main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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)) { -- cgit 1.2.3-korg