From 3b867a533dd423c8e54559a731bd89bb9a0a815c Mon Sep 17 00:00:00 2001 From: inoshperera Date: Thu, 24 Nov 2016 12:46:33 +0530 Subject: [PATCH] fixing http status code --- .../android/services/impl/DeviceManagementServiceImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java index 2117cccec7..4ca9b9b44d 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java @@ -278,7 +278,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { public Response modifyEnrollment(@PathParam("id") String id, @Valid AndroidDevice androidDevice) { Device device; DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); - deviceIdentifier.setId(androidDevice.getDeviceIdentifier()); + deviceIdentifier.setId(id); deviceIdentifier.setType(AndroidConstants.DEVICE_TYPE_ANDROID); try { device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier); @@ -299,8 +299,8 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { if (device == null) { String errorMessage = "The device to be modified doesn't exist."; log.error(errorMessage); - throw new org.wso2.carbon.mdm.services.android.exception.BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); + throw new org.wso2.carbon.mdm.services.android.exception.NotFoundException( + new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage(errorMessage).build()); } if(androidDevice.getEnrolmentInfo() != null){ device.setEnrolmentInfo(device.getEnrolmentInfo());