From fa82a28c0f704a60078a240856a9d77abe51539d Mon Sep 17 00:00:00 2001 From: mharindu Date: Sat, 22 Aug 2015 05:15:05 +0530 Subject: [PATCH] Added null check to MonitoringManagerImpl --- .../carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java index 3b68e5b548..34a9ad9aaa 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java @@ -95,6 +95,7 @@ public class MonitoringManagerImpl implements MonitoringManager { ComplianceData cmd = monitoringDAO.getCompliance(device.getId()); complianceData = monitoringService.checkPolicyCompliance(deviceIdentifier, policy, deviceResponse); + complianceData.setId(cmd.getId()); complianceData.setPolicy(policy); complianceFeatures = complianceData.getComplianceFeatures(); @@ -108,7 +109,7 @@ public class MonitoringManagerImpl implements MonitoringManager { //This was added because update query below that did not return the update table primary key. - if (!complianceFeatures.isEmpty()) { + if (complianceFeatures != null && !complianceFeatures.isEmpty()) { PolicyManagementDAOFactory.beginTransaction(); monitoringDAO.setDeviceAsNoneCompliance(device.getId(), policy.getId()); if (log.isDebugEnabled()) {