From 7ab31ae7d8692d01f1cbfedb4039a6d4afa22990 Mon Sep 17 00:00:00 2001 From: charitha Date: Wed, 13 Dec 2017 13:56:29 +0530 Subject: [PATCH] Fixed https://github.com/wso2/product-iots/issues/1523 --- .../carbon/policy/mgt/core/enforcement/DelegationTask.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/enforcement/DelegationTask.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/enforcement/DelegationTask.java index bae2b48623..bd014817ff 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/enforcement/DelegationTask.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/enforcement/DelegationTask.java @@ -22,6 +22,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.ntask.core.Task; import org.wso2.carbon.policy.mgt.common.PolicyManagementException; @@ -75,7 +76,10 @@ public class DelegationTask implements Task { //HashMap deviceIdPolicy = policyManager.getAppliedPolicyIdsDeviceIds(); for (Device device : devices) { // if (deviceIdPolicy.containsKey(device.getId())) { - toBeNotified.add(device); + if (device != null && device.getEnrolmentInfo() != null + && device.getEnrolmentInfo().getStatus() != EnrolmentInfo.Status.REMOVED) { + toBeNotified.add(device); + } // } } if (!toBeNotified.isEmpty()) {