From ca681815418f9abf50f83076163e5b7150875b37 Mon Sep 17 00:00:00 2001 From: susinda Date: Thu, 13 Oct 2016 12:11:37 +0530 Subject: [PATCH] Fixing NPE of EMM-1715 --- .../carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java | 3 +++ 1 file changed, 3 insertions(+) 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 91d16cb01a9..71da91c839d 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 @@ -380,8 +380,11 @@ public class MonitoringManagerImpl implements MonitoringManager { List deviceTypes = new ArrayList<>(); try { + //when shutdown, it sets DeviceManagementService to null, therefore need to have a null check + if (PolicyManagementDataHolder.getInstance().getDeviceManagementService() != null) { deviceTypes = PolicyManagementDataHolder.getInstance().getDeviceManagementService().getAvailableDeviceTypes(); + } } catch (DeviceManagementException e) { throw new PolicyComplianceException("Error occurred while getting the device types.", e); }