Skip to content

Commit

Permalink
Fix program crash when try to show command helper info (#24809)
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca authored and pull[bot] committed Nov 30, 2023
1 parent c27b24a commit 6f21ed5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ public static void main(String[] args) {

try {
commandManager.run(args);
} catch (IllegalArgumentException e) {
logger.log(Level.INFO, "Arguments init failed with exception: " + e.getMessage());
System.exit(1);
} catch (Exception e) {
logger.log(Level.INFO, "Run command failed with exception: " + e.getMessage());
System.exit(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,14 @@ public final void run(String[] args) throws Exception {
// need skip over binary and command name and only get arguments
String[] temp = Arrays.copyOfRange(args, 2, args.length);

command.initArguments(temp.length, temp);
showCommand(args[0], command);
try {
command.initArguments(temp.length, temp);
} catch (IllegalArgumentException e) {
logger.log(Level.INFO, "Arguments init failed with exception: " + e.getMessage());
showCommand(args[0], command);
System.exit(1);
}

command.run();
}

Expand Down

0 comments on commit 6f21ed5

Please sign in to comment.