diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsPolicyMonitoringService.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsPolicyMonitoringService.java index ecc9e36ad..5f91185e9 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsPolicyMonitoringService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsPolicyMonitoringService.java @@ -47,19 +47,22 @@ public class WindowsPolicyMonitoringService implements PolicyMonitoringService { if (log.isDebugEnabled()) { log.debug("checking policy compliance status of device '" + deviceIdentifier.getId() + "'"); } + List complianceFeatures = (List) compliancePayload; + List nonComplianceFeatures = new ArrayList<>(); ComplianceData complianceData = new ComplianceData(); + if (policy == null || compliancePayload == null) { return complianceData; } - List complianceFeatures = new ArrayList(); - complianceData.setComplianceFeatures((List) compliancePayload); for (ComplianceFeature cf : complianceFeatures) { if (!cf.isCompliant()) { complianceData.setStatus(false); + nonComplianceFeatures.add(cf); break; } } + complianceData.setComplianceFeatures(nonComplianceFeatures); return complianceData; }