From 1112b285d5c67c35b0158c86d6469b44459e0b43 Mon Sep 17 00:00:00 2001 From: Pahansith Gunathilake Date: Tue, 19 May 2020 10:27:13 +0000 Subject: [PATCH] Remove operation existence check in update operation --- .../DeviceManagementProviderServiceImpl.java | 15 ++------------- 1 file changed, 2 insertions(+), 13 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 e1776f3fa7..e0aceb6597 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 @@ -1912,16 +1912,9 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv device.getType()); } try { - DeviceIdentifier deviceIdentifier = new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()); - if (!pluginRepository.getOperationManager(device.getType(), this.getTenantId()) - .isOperationExist(deviceIdentifier, operation.getId())) { - String msg = "Operation with operation id: " + operation.getId() - + " does not exist."; - log.error(msg); - throw new BadRequestException(msg); - } pluginRepository.getOperationManager(device.getType(), this.getTenantId()) - .updateOperation(deviceIdentifier, operation); + .updateOperation(device.getEnrolmentInfo().getId(), operation, + new DeviceIdentifier(device.getDeviceIdentifier(), device.getType())); if (DeviceManagerUtil.isPublishOperationResponseEnabled()) { List permittedOperations = DeviceManagerUtil.getEnabledOperationsForResponsePublish(); if (permittedOperations.contains(operation.getCode()) @@ -1948,10 +1941,6 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv String msg = "Error occurred while publishing event."; log.error(msg, e); throw new OperationManagementException(msg, e); - } catch (BadRequestException e) { - String msg = "Error occurred due to invalid request"; - log.error(msg, e); - throw new OperationManagementException(msg, e); } }