From f29b9e84f2993cbd40001418ac5bc3eed1534dab Mon Sep 17 00:00:00 2001 From: Chatura Dilan Perera Date: Wed, 31 Aug 2016 13:56:59 +0530 Subject: [PATCH 1/2] Fixed 200 returns when activities are empty and since is a future date --- .../mgt/jaxrs/service/impl/ActivityProviderServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 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/ActivityProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ActivityProviderServiceImpl.java index 9b0c4e9975..6ef0a8664d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ActivityProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ActivityProviderServiceImpl.java @@ -122,7 +122,7 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService int count = dmService.getActivityCountUpdatedAfter(timestamp); activityList.setCount(count); if (activities == null || activities.size() == 0) { - if (isIfModifiedSinceSet || isSinceSet) { + if (isIfModifiedSinceSet) { return Response.notModified().build(); } } From 3575c9a33d7ceae5d4dd1b583ea0894a4827bb40 Mon Sep 17 00:00:00 2001 From: charitha Date: Wed, 31 Aug 2016 17:42:03 +0530 Subject: [PATCH 2/2] Fix issue in get devices with since parameter. --- .../mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java | 5 ++++- 1 file changed, 4 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 705328d96a..8edc3bc98d 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 @@ -51,6 +51,7 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -128,7 +129,9 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { request.setSince(sinceDate); result = dms.getAllDevices(request); if (result == null || result.getData() == null || result.getData().size() <= 0) { - return Response.status(Response.Status.OK).entity(new JsonArray()).build(); + devices.setList(new ArrayList()); + devices.setCount(0); + return Response.status(Response.Status.OK).entity(devices).build(); } } else { result = dms.getAllDevices(request);