File tree Expand file tree Collapse file tree 3 files changed +31
-8
lines changed
iotdb-client/cli/src/main/java/org/apache/iotdb/tool Expand file tree Collapse file tree 3 files changed +31
-8
lines changed Original file line number Diff line number Diff line change @@ -242,6 +242,11 @@ public static void main(String[] args) {
242242 true );
243243 System .exit (CODE_ERROR );
244244 }
245+ } else {
246+ ioTPrinter .println (
247+ String .format (
248+ "Invalid args: Required values for option '%s' not provided" , FILE_TYPE_NAME ));
249+ System .exit (CODE_ERROR );
245250 }
246251 int exitCode = CODE_OK ;
247252 try {
@@ -531,6 +536,12 @@ private static void parseSpecialParams(CommandLine commandLine) throws ArgsError
531536 if (!targetDirectory .endsWith ("/" ) && !targetDirectory .endsWith ("\\ " )) {
532537 targetDirectory += File .separator ;
533538 }
539+ final File file = new File (targetDirectory );
540+ if (!file .isDirectory ()) {
541+ ioTPrinter .println (
542+ String .format ("Source file or directory %s does not exist" , targetDirectory ));
543+ System .exit (CODE_ERROR );
544+ }
534545 if (commandLine .getOptionValue (LINES_PER_FILE_ARGS ) != null ) {
535546 linesPerFile = Integer .parseInt (commandLine .getOptionValue (LINES_PER_FILE_ARGS ));
536547 }
Original file line number Diff line number Diff line change @@ -366,6 +366,12 @@ private static void parseSpecialParams(CommandLine commandLine) throws ArgsError
366366 }
367367 if (commandLine .getOptionValue (THREAD_NUM_ARGS ) != null ) {
368368 threadNum = Integer .parseInt (commandLine .getOptionValue (THREAD_NUM_ARGS ));
369+ if (threadNum <= 0 ) {
370+ ioTPrinter .println (
371+ String .format (
372+ "error: Invalid thread number '%s'. Please set a positive integer." , threadNum ));
373+ System .exit (CODE_ERROR );
374+ }
369375 }
370376 if (commandLine .getOptionValue (TIMESTAMP_PRECISION_ARGS ) != null ) {
371377 timestampPrecision = commandLine .getOptionValue (TIMESTAMP_PRECISION_ARGS );
@@ -512,16 +518,16 @@ public static void main(String[] args) throws IoTDBConnectionException {
512518 System .exit (CODE_ERROR );
513519 }
514520 } else {
515- printHelpOptions (
516- TSFILEDB_CLI_HEAD ,
517- TSFILEDB_CLI_PREFIX ,
518- hf ,
519- tsFileOptions ,
520- csvOptions ,
521- sqlOptions ,
522- true );
521+ ioTPrinter .println (
522+ String .format (
523+ "Invalid args: Required values for option '%s' not provided" , FILE_TYPE_NAME ));
523524 System .exit (CODE_ERROR );
524525 }
526+ } else {
527+ ioTPrinter .println (
528+ String .format (
529+ "Invalid args: Required values for option '%s' not provided" , FILE_TYPE_NAME ));
530+ System .exit (CODE_ERROR );
525531 }
526532
527533 try {
Original file line number Diff line number Diff line change @@ -252,6 +252,12 @@ private static void parseSpecialParamsBack(CommandLine commandLine) throws ArgsE
252252 if (!targetDirectory .endsWith ("/" ) && !targetDirectory .endsWith ("\\ " )) {
253253 targetDirectory += File .separator ;
254254 }
255+ final File file = new File (targetDirectory );
256+ if (!file .isDirectory ()) {
257+ ioTPrinter .println (
258+ String .format ("Source file or directory %s does not exist" , targetDirectory ));
259+ System .exit (CODE_ERROR );
260+ }
255261 }
256262
257263 /**
You can’t perform that action at this time.
0 commit comments