ArafatKhan2198 commented on code in PR #4158:
URL: https://github.com/apache/ozone/pull/4158#discussion_r1083729521


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/ContainerEndpoint.java:
##########
@@ -112,21 +117,29 @@ public Response getContainers(
           int limit,
       @DefaultValue(PREV_CONTAINER_ID_DEFAULT_VALUE)
       @QueryParam(RECON_QUERY_PREVKEY) long prevKey) {
-    Map<Long, ContainerMetadata> containersMap;
-    long containersCount;
-    try {
-      containersMap =
-              reconContainerMetadataManager.getContainers(limit, prevKey);
-      containersCount = reconContainerMetadataManager.getCountForContainers();
-    } catch (IOException ioEx) {
-      throw new WebApplicationException(ioEx,
-          Response.Status.INTERNAL_SERVER_ERROR);
+    if (limit < 0 || prevKey < 0) {
+      // Send back an empty response
+      return Response.ok().build();

Review Comment:
   Yes, that is a good suggestion!
   It would be more appropriate to return a "not acceptable" status code (HTTP 
status code 406) if the limit or prevKey is negative, as that shows that the 
request is not valid.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to