diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/enforcement/PolicyEnforcementDelegatorImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/enforcement/PolicyEnforcementDelegatorImpl.java index 304482f136..2fa70bb3af 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/enforcement/PolicyEnforcementDelegatorImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/enforcement/PolicyEnforcementDelegatorImpl.java @@ -68,12 +68,14 @@ public class PolicyEnforcementDelegatorImpl implements PolicyEnforcementDelegato identifier.setType(device.getType()); Policy policy = this.getEffectivePolicy(identifier); - + List deviceIdentifiers = new ArrayList<>(); + deviceIdentifiers.add(identifier); if (policy != null) { - List deviceIdentifiers = new ArrayList<>(); - deviceIdentifiers.add(identifier); this.addPolicyRevokeOperation(deviceIdentifiers); this.addPolicyOperation(deviceIdentifiers, policy); + } else { + //This means all the applicable policies have been removed from device. Hence calling a policy revoke. + this.addPolicyRevokeOperation(deviceIdentifiers); } } }