chengshiwen commented on a change in pull request #4899:
URL: 
https://github.com/apache/incubator-dolphinscheduler/pull/4899#discussion_r584055562



##########
File path: 
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
##########
@@ -390,6 +390,23 @@ public void testBatchExportProcessDefinitionByIds() throws 
Exception {
     @Test
     public void testQueryProcessDefinitionVersions() {
         String projectName = "test";
+
+        Result result = 
processDefinitionController.queryProcessDefinitionVersions(
+                user
+                , projectName
+                , 1
+                , -10
+                , 1);

Review comment:
       It is better to put all the parameters on one line

##########
File path: 
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
##########
@@ -296,8 +296,13 @@ public Result queryProcessDefinitionVersions(@ApiIgnore 
@RequestAttribute(value
                                                  @RequestParam(value = 
"pageNo") int pageNo,
                                                  @RequestParam(value = 
"pageSize") int pageSize,
                                                  @RequestParam(value = 
"processDefinitionId") int processDefinitionId) {
-
-        Map<String, Object> result = 
processDefinitionVersionService.queryProcessDefinitionVersions(loginUser
+        logger.info("query process definition versions, login user {}, project 
name: {}, process define id: {}, list paging, pageNo: {}, pageSize: {}",
+                loginUser.getUserName(), projectName, processDefinitionId, 
pageNo, pageSize);

Review comment:
       
![image](https://user-images.githubusercontent.com/4902714/109378110-d2e83800-790a-11eb-9178-7db1f4462f32.png)
   TO fix the vulnerability  `Change this code to not log user-controlled 
data`, you can use `RegexUtils.escapeNRT(loginUser.getUserName())`. Otherwise, 
you cannot pass the SonarCloud Quality Gate Test.

##########
File path: 
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
##########
@@ -390,6 +390,23 @@ public void testBatchExportProcessDefinitionByIds() throws 
Exception {
     @Test
     public void testQueryProcessDefinitionVersions() {
         String projectName = "test";
+
+        Result result = 
processDefinitionController.queryProcessDefinitionVersions(
+                user
+                , projectName
+                , 1
+                , -10
+                , 1);
+        Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR.getCode(), 
result.getCode().intValue());
+
+        result = processDefinitionController.queryProcessDefinitionVersions(
+                user
+                , projectName
+                , -1
+                , 10
+                , 1);

Review comment:
       It is better to put all the parameters on one line




----------------------------------------------------------------
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.

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


Reply via email to