From e80589d3b17033b84633b6798d714cf0aac3eccf Mon Sep 17 00:00:00 2001 From: Amanda Randombage <74random.amanda@gmail.com> Date: Wed, 9 Oct 2019 10:19:55 +0000 Subject: [PATCH] Fix Permanent delete for multiple enrollments --- .../core/service/DeviceManagementProviderServiceImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index 42c2cf7862..1e3681ab91 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -533,10 +533,10 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv try { DeviceManagementDAOFactory.beginTransaction(); existingDevices = deviceDAO.getDevicesByIdentifiers(deviceIdentifiers, tenantId); - if (existingDevices.size() != deviceIdentifiers.size()) { - for (Device device : existingDevices) { - deviceIdentifiers.remove(device.getDeviceIdentifier()); - } + for (Device device : existingDevices) { + deviceIdentifiers.remove(device.getDeviceIdentifier()); + } + if (!deviceIdentifiers.isEmpty()) { String msg = "Couldn't find device ids for all the requested device identifiers. " + "Therefore payload should contain device identifiers which are not in the system. " +