You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by "gosonzhang (via GitHub)" <gi...@apache.org> on 2023/01/29 07:38:34 UTC

[GitHub] [inlong] gosonzhang commented on a diff in pull request #7279: [INLONG-7278][Manager] Optimize OpenInLongClusterController implementation

gosonzhang commented on code in PR #7279:
URL: https://github.com/apache/inlong/pull/7279#discussion_r1089887558


##########
inlong-manager/manager-web/src/main/java/org/apache/inlong/manager/web/controller/openapi/OpenInLongClusterController.java:
##########
@@ -68,93 +70,115 @@ public class OpenInLongClusterController {
     @ApiOperation(value = "Get cluster tag by id")
     @ApiImplicitParam(name = "id", value = "Cluster ID", dataTypeClass = Integer.class, required = true)
     public Response<ClusterTagResponse> getTag(@PathVariable Integer id) {
+        Preconditions.checkNull(id, ErrorCodeEnum.INVALID_PARAMETER, "tag id cannot be null");
+        Preconditions.checkNull(LoginUserUtils.getLoginUser(), ErrorCodeEnum.LOGIN_USER_EMPTY);
         return Response.success(clusterService.getTag(id, LoginUserUtils.getLoginUser()));
     }
 
     @PostMapping(value = "/cluster/tag/list")
     @ApiOperation(value = "List cluster tags")
     public Response<List<ClusterTagResponse>> listTag(@RequestBody ClusterTagPageRequest request) {
+        Preconditions.checkNull(request, ErrorCodeEnum.INVALID_PARAMETER, "request cannot be null");

Review Comment:
   This is not a problem, the implementation of this function is to check whether the target is null, and throw an exception when the target is null.
   
   There is no problem with the implementation, but the API naming needs to be modified:
   Check only expresses the action, not the expected result, so there is ambiguity. A issue will be mentioned later to modify the naming problem



-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org