Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ public static void main(String[] args) {
true);
System.exit(CODE_ERROR);
}
} else {
ioTPrinter.println(
String.format(
"Invalid args: Required values for option '%s' not provided", FILE_TYPE_NAME));
System.exit(CODE_ERROR);
}
int exitCode = CODE_OK;
try {
Expand Down Expand Up @@ -531,6 +536,12 @@ private static void parseSpecialParams(CommandLine commandLine) throws ArgsError
if (!targetDirectory.endsWith("/") && !targetDirectory.endsWith("\\")) {
targetDirectory += File.separator;
}
final File file = new File(targetDirectory);
if (!file.isDirectory()) {
ioTPrinter.println(
String.format("Source file or directory %s does not exist", targetDirectory));
System.exit(CODE_ERROR);
}
if (commandLine.getOptionValue(LINES_PER_FILE_ARGS) != null) {
linesPerFile = Integer.parseInt(commandLine.getOptionValue(LINES_PER_FILE_ARGS));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,12 @@ private static void parseSpecialParams(CommandLine commandLine) throws ArgsError
}
if (commandLine.getOptionValue(THREAD_NUM_ARGS) != null) {
threadNum = Integer.parseInt(commandLine.getOptionValue(THREAD_NUM_ARGS));
if (threadNum <= 0) {
ioTPrinter.println(
String.format(
"error: Invalid thread number '%s'. Please set a positive integer.", threadNum));
System.exit(CODE_ERROR);
}
}
if (commandLine.getOptionValue(TIMESTAMP_PRECISION_ARGS) != null) {
timestampPrecision = commandLine.getOptionValue(TIMESTAMP_PRECISION_ARGS);
Expand Down Expand Up @@ -512,16 +518,16 @@ public static void main(String[] args) throws IoTDBConnectionException {
System.exit(CODE_ERROR);
}
} else {
printHelpOptions(
TSFILEDB_CLI_HEAD,
TSFILEDB_CLI_PREFIX,
hf,
tsFileOptions,
csvOptions,
sqlOptions,
true);
ioTPrinter.println(
String.format(
"Invalid args: Required values for option '%s' not provided", FILE_TYPE_NAME));
System.exit(CODE_ERROR);
}
} else {
ioTPrinter.println(
String.format(
"Invalid args: Required values for option '%s' not provided", FILE_TYPE_NAME));
System.exit(CODE_ERROR);
}

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ private static void parseSpecialParamsBack(CommandLine commandLine) throws ArgsE
if (!targetDirectory.endsWith("/") && !targetDirectory.endsWith("\\")) {
targetDirectory += File.separator;
}
final File file = new File(targetDirectory);
if (!file.isDirectory()) {
ioTPrinter.println(
String.format("Source file or directory %s does not exist", targetDirectory));
System.exit(CODE_ERROR);
}
}

/**
Expand Down