From 3d2282eb3e7cd06ba9543b0ce5f44778dbebc92f Mon Sep 17 00:00:00 2001 From: Roberto Cortez Date: Thu, 13 Jun 2024 14:42:04 +0100 Subject: [PATCH] Do not rethrow SmallRye Config ConfigValidationException in Quarkus ConfigException --- .../io/quarkus/runtime/ApplicationLifecycleManager.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java b/core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java index f83c1c256ada3..fa2d8b32c4255 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java @@ -24,11 +24,11 @@ import io.quarkus.bootstrap.logging.InitialConfigurator; import io.quarkus.bootstrap.runner.RunnerClassLoader; -import io.quarkus.runtime.configuration.ConfigUtils; import io.quarkus.runtime.configuration.ConfigurationException; import io.quarkus.runtime.graal.DiagnosticPrinter; import io.quarkus.runtime.util.ExceptionUtil; import io.quarkus.runtime.util.StringUtil; +import io.smallrye.config.ConfigValidationException; import sun.misc.Signal; import sun.misc.SignalHandler; @@ -188,15 +188,13 @@ public static void run(Application application, Class'."); } - } else if (rootCause instanceof ConfigurationException) { + } else if (rootCause instanceof ConfigurationException || rootCause instanceof ConfigValidationException) { System.err.println(rootCause.getMessage()); } else if (rootCause instanceof PreventFurtherStepsException && !StringUtil.isNullOrEmpty(rootCause.getMessage())) { System.err.println(rootCause.getMessage()); } else { - // If it is not a ConfigurationException it should be safe to call ConfigProvider.getConfig here - applicationLogger.errorv(e, "Failed to start application (with profile {0})", - ConfigUtils.getProfiles()); + applicationLogger.errorv(e, "Failed to start application"); ensureConsoleLogsDrained(); } }