From 7ad790be548c8c81c7e895a934e27af0c5c98200 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Wed, 28 Feb 2018 19:30:33 +0530 Subject: [PATCH] Fix error log printed when undeploying the devicemgt provider Resolves https://github.com/wso2/product-iots/issues/1724 (cherry picked from commit c72d4ea) --- .../mgt/core/DeviceManagementPluginRepository.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementPluginRepository.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementPluginRepository.java index 93bee26a82..ef3ed97888 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementPluginRepository.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementPluginRepository.java @@ -23,6 +23,7 @@ import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceStatusTaskPluginConfig; +import org.wso2.carbon.device.mgt.common.InvalidConfigurationException; import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig; import org.wso2.carbon.device.mgt.common.ProvisioningConfig; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager; @@ -153,9 +154,13 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis OperationManager operationManager = operationManagerRepository.getOperationManager( deviceTypeIdentifier); if (operationManager != null) { - NotificationStrategy notificationStrategy = operationManager.getNotificationStrategy(); - if (notificationStrategy != null) { - notificationStrategy.undeploy(); + try { + NotificationStrategy notificationStrategy = operationManager.getNotificationStrategy(); + if (notificationStrategy != null) { + notificationStrategy.undeploy(); + } + } catch (InvalidConfigurationException ignore) { + //error occurred while undeploying strategy, ignore error } operationManagerRepository.removeOperationManager(deviceTypeIdentifier); }