From f2455e3bcfcf34cbe61cfd3bdf4afed598c1c0e4 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Tue, 2 Jul 2024 16:28:49 +0200 Subject: [PATCH] Catch exceptions when running checkMissingCommand We want to check for the missing commands only, any other error will have to be handled by Picocli later (and thus will properly handle the formatting of the feedback and avoid a stacktrace). Fixes #41513 --- devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java b/devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java index be09f9207e77a..0551ebb9abddd 100644 --- a/devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java +++ b/devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java @@ -185,6 +185,11 @@ public Optional checkMissingCommand(CommandLine root, String[] args) { return Optional.empty(); } catch (UnmatchedArgumentException e) { return Optional.of(args[0]); + } catch (Exception e) { + // For any other exceptions (e.g. MissingParameterException), we should just ignore. + // The problem is not that the command is missing but that the options might not be adequate. + // This will be handled by Picocli at a later step. + return Optional.empty(); } }