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 fc004bbc7a4..a150bed3273 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 @@ -72,29 +72,29 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { @QueryParam("offset") int offset, @QueryParam("limit") int limit) { try { - RequestValidationUtil.validateSelectionCriteria(type, user, roleName, ownership, status); +// RequestValidationUtil.validateSelectionCriteria(type, user, roleName, ownership, status); DeviceManagementProviderService dms = DeviceMgtAPIUtils.getDeviceManagementService(); PaginationRequest request = new PaginationRequest(offset, limit); PaginationResult result; DeviceList devices = new DeviceList(); - if (type != null) { + if (type != null && !type.isEmpty()) { request.setDeviceType(type); } - if (user != null) { + if (user != null && !user.isEmpty()) { request.setOwner(user); } - if (ownership != null) { + if (ownership != null && !ownership.isEmpty()) { RequestValidationUtil.validateOwnershipType(ownership); request.setOwnership(ownership); } - if (status != null) { + if (status != null && !status.isEmpty()) { RequestValidationUtil.validateStatus(status); request.setStatus(status); } - if (ifModifiedSince != null) { + if (ifModifiedSince != null && !ifModifiedSince.isEmpty()) { Date sinceDate; SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z"); try { @@ -110,7 +110,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { return Response.status(Response.Status.NOT_MODIFIED).entity("No device is modified " + "after the timestamp provided in 'If-Modified-Since' header").build(); } - } else if (since != null) { + } else if (since != null && !since.isEmpty()) { Date sinceDate; SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z"); try {