From 2b7d5fd66b8128c940f832e65d0b26015b248c34 Mon Sep 17 00:00:00 2001 From: geethkokila Date: Thu, 15 Dec 2016 10:57:48 +0530 Subject: [PATCH] Fixing the null pointer issue in policy manager --- .../wso2/carbon/policy/mgt/core/impl/PolicyFilterImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/impl/PolicyFilterImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/impl/PolicyFilterImpl.java index 18cf7a1560..f589d5bfd2 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/impl/PolicyFilterImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/impl/PolicyFilterImpl.java @@ -70,7 +70,10 @@ public class PolicyFilterImpl implements PolicyFilter { Map policyMap = new HashMap<>(); for (Policy policy : policies) { List wrappers = policy.getDeviceGroups(); - if (PolicyManagementConstants.ANY.equalsIgnoreCase(wrappers.get(0).getName())) { + if (wrappers.isEmpty()) { + temp.add(policy); + continue; + } else if (PolicyManagementConstants.ANY.equalsIgnoreCase(wrappers.get(0).getName())) { temp.add(policy); policyMap.put(policy.getId(), policy); continue;