From f4b8e4bb7430e71b05ea0138f10a76e9a7ad6f76 Mon Sep 17 00:00:00 2001 From: manoj Date: Fri, 15 May 2015 12:04:01 +0530 Subject: [PATCH] Remove delete device type from DB when un register plugin --- .../carbon/device/mgt/core/DeviceManagementRepository.java | 6 ------ .../wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementRepository.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementRepository.java index 8b8e22b75e..596d1202a0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementRepository.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementRepository.java @@ -45,12 +45,6 @@ public class DeviceManagementRepository { public void removeDeviceManagementProvider(DeviceMgtService provider) throws DeviceManagementException { String deviceType = provider.getProviderType(); - try { - DeviceManagerUtil.unregisterDeviceType(deviceType); - } catch (DeviceManagementException e) { - throw new DeviceManagementException("Error occurred while removing device management provider '" + - deviceType + "'", e); - } providers.remove(deviceType); } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java index f716bf6e2e..308ed6813f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java @@ -142,7 +142,7 @@ public final class DeviceManagerUtil { try { DeviceTypeDAO deviceTypeDAO = DeviceManagementDAOFactory.getDeviceTypeDAO(); DeviceType deviceType = deviceTypeDAO.getDeviceType(typeName); - if (deviceType == null) { + if (deviceType != null) { DeviceType dt = new DeviceType(); dt.setName(typeName); deviceTypeDAO.removeDeviceType(typeName);