From f2ab923df5c547e8b775bf1dc98f4e851b909784 Mon Sep 17 00:00:00 2001 From: madhawap Date: Mon, 20 Jun 2016 12:17:59 +0530 Subject: [PATCH] fix related to http status code in 'getDevices' endpoint --- .../mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java index 352df1fa39..9fcb5824a3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java @@ -127,7 +127,8 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { } } else { result = dms.getAllDevices(request); - if (result == null) { + int resultCount = result.getRecordsTotal(); + if (resultCount == 0) { throw new NotFoundException( new ErrorResponse.ErrorResponseBuilder().setCode(404l).setMessage("No device is currently" + " enrolled with the server").build());