You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2021/09/09 07:03:19 UTC

[iotdb] branch master updated: [IOTDB-1659] Fix Windows CLI cannot set maxPRC less than or equal to 0 (#3936)

This is an automated email from the ASF dual-hosted git repository.

qiaojialin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 601df56  [IOTDB-1659] Fix Windows CLI cannot set maxPRC less than or equal to 0 (#3936)
601df56 is described below

commit 601df56b76df7dbda720361a536ab66e492f1b25
Author: Haonan <hh...@outlook.com>
AuthorDate: Thu Sep 9 15:02:23 2021 +0800

    [IOTDB-1659] Fix Windows CLI cannot set maxPRC less than or equal to 0 (#3936)
---
 cli/src/main/java/org/apache/iotdb/cli/Cli.java    |  2 +-
 cli/src/main/java/org/apache/iotdb/cli/WinCli.java | 12 ++++------
 .../org/apache/iotdb/cli/StartClientScriptIT.java  | 27 ++++++++++++++++++++++
 3 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/cli/src/main/java/org/apache/iotdb/cli/Cli.java b/cli/src/main/java/org/apache/iotdb/cli/Cli.java
index d1b0735..37567fb 100644
--- a/cli/src/main/java/org/apache/iotdb/cli/Cli.java
+++ b/cli/src/main/java/org/apache/iotdb/cli/Cli.java
@@ -102,7 +102,7 @@ public class Cli extends AbstractCli {
     } catch (NumberFormatException e) {
       println(
           IOTDB_CLI_PREFIX
-              + "> error format of max print row count, it should be a number and greater than 0");
+              + "> error format of max print row count, it should be an integer number");
       return false;
     }
     return true;
diff --git a/cli/src/main/java/org/apache/iotdb/cli/WinCli.java b/cli/src/main/java/org/apache/iotdb/cli/WinCli.java
index 1ef3cd9..d496a24 100644
--- a/cli/src/main/java/org/apache/iotdb/cli/WinCli.java
+++ b/cli/src/main/java/org/apache/iotdb/cli/WinCli.java
@@ -99,20 +99,16 @@ public class WinCli extends AbstractCli {
         timeFormat = RpcUtils.setTimeFormat("long");
       }
       if (commandLine.hasOption(MAX_PRINT_ROW_COUNT_ARGS)) {
-        maxPrintRowCount = Integer.parseInt(commandLine.getOptionValue(MAX_PRINT_ROW_COUNT_ARGS));
-        if (maxPrintRowCount <= 0) {
-          println(
-              IOTDB_CLI_PREFIX
-                  + "> error format of max print row count, it should be a number greater than 0");
-          return false;
-        }
+        setMaxDisplayNumber(commandLine.getOptionValue(MAX_PRINT_ROW_COUNT_ARGS));
       }
     } catch (ParseException e) {
       println("Require more params input, please check the following hint.");
       hf.printHelp(IOTDB_CLI_PREFIX, options, true);
       return false;
     } catch (NumberFormatException e) {
-      println(IOTDB_CLI_PREFIX + "> error format of max print row count, it should be a number");
+      println(
+          IOTDB_CLI_PREFIX
+              + "> error format of max print row count, it should be an integer number");
       return false;
     }
     return true;
diff --git a/cli/src/test/java/org/apache/iotdb/cli/StartClientScriptIT.java b/cli/src/test/java/org/apache/iotdb/cli/StartClientScriptIT.java
index 829cd9a..7fa89bb 100644
--- a/cli/src/test/java/org/apache/iotdb/cli/StartClientScriptIT.java
+++ b/cli/src/test/java/org/apache/iotdb/cli/StartClientScriptIT.java
@@ -75,9 +75,23 @@ public class StartClientScriptIT extends AbstractScript {
             "cmd.exe",
             "/c",
             dir + File.separator + "sbin" + File.separator + "start-cli.bat",
+            "-maxPRC",
+            "0",
             "-e",
             "\"flush\"");
     testOutput(builder2, output2);
+
+    final String[] output3 = {
+      "IoTDB> error format of max print row count, it should be an integer number"
+    };
+    ProcessBuilder builder3 =
+        new ProcessBuilder(
+            "cmd.exe",
+            "/c",
+            dir + File.separator + "sbin" + File.separator + "start-cli.bat",
+            "-maxPRC",
+            "-1111111111111111111111111111");
+    testOutput(builder3, output3);
   }
 
   @Override
@@ -105,8 +119,21 @@ public class StartClientScriptIT extends AbstractScript {
         new ProcessBuilder(
             "sh",
             dir + File.separator + "sbin" + File.separator + "start-cli.sh",
+            "-maxPRC",
+            "0",
             "-e",
             "\"flush\"");
     testOutput(builder2, output2);
+
+    final String[] output3 = {
+      "IoTDB> error format of max print row count, it should be an integer number"
+    };
+    ProcessBuilder builder3 =
+        new ProcessBuilder(
+            "sh",
+            dir + File.separator + "sbin" + File.separator + "start-cli.sh",
+            "-maxPRC",
+            "-1111111111111111111111111111");
+    testOutput(builder3, output3);
   }
 }