From c5397cde671448c04d94144ea74fa591d101f502 Mon Sep 17 00:00:00 2001 From: hasuniea Date: Tue, 6 Oct 2015 18:37:58 +0530 Subject: [PATCH] refactored checkPolicyCompliance --- .../impl/windows/WindowsPolicyMonitoringService.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 ecc9e36ada..5f91185e92 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; }