This is an automated email from the ASF dual-hosted git repository. haonan pushed a commit to branch cli_bug_0.12 in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 32f71dd67ac34d0f25fc6488f438160b6ebaece9 Author: Haonan <[email protected]> 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 0889735..6e57d27 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 34f44f7..7d9e938 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); } }
