diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/RuntimeConfigSetupBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/RuntimeConfigSetupBuildStep.java index ee549589ec1a16..ef5fcb0467473e 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/RuntimeConfigSetupBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/RuntimeConfigSetupBuildStep.java @@ -10,14 +10,11 @@ import io.quarkus.deployment.builditem.GeneratedClassBuildItem; import io.quarkus.deployment.builditem.MainBytecodeRecorderBuildItem; import io.quarkus.deployment.builditem.RuntimeConfigSetupCompleteBuildItem; -import io.quarkus.gizmo.CatchBlockCreator; import io.quarkus.gizmo.ClassCreator; import io.quarkus.gizmo.ClassOutput; import io.quarkus.gizmo.MethodCreator; -import io.quarkus.gizmo.TryBlock; import io.quarkus.runtime.StartupContext; import io.quarkus.runtime.StartupTask; -import io.quarkus.runtime.configuration.ConfigurationException; public class RuntimeConfigSetupBuildStep { private static final String RUNTIME_CONFIG_STARTUP_TASK_CLASS_NAME = "io.quarkus.deployment.steps.RuntimeConfigSetup"; @@ -40,17 +37,11 @@ void setupRuntimeConfig( .interfaces(StartupTask.class).build()) { try (MethodCreator method = clazz.getMethodCreator("deploy", void.class, StartupContext.class)) { - TryBlock tryBlock = method.tryBlock(); - tryBlock.invokeVirtualMethod( - ofMethod(StartupContext.class, "setCurrentBuildStepName", void.class, String.class), + method.invokeVirtualMethod(ofMethod(StartupContext.class, "setCurrentBuildStepName", void.class, String.class), method.getMethodParam(0), method.load("RuntimeConfigSetupBuildStep.setupRuntimeConfig")); - tryBlock.invokeStaticMethod(C_CREATE_RUN_TIME_CONFIG); - tryBlock.returnValue(null); - - CatchBlockCreator cb = tryBlock.addCatch(RuntimeException.class); - cb.throwException(ConfigurationException.class, "Failed to read configuration properties", - cb.getCaughtException()); + method.invokeStaticMethod(C_CREATE_RUN_TIME_CONFIG); + method.returnValue(null); } } 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 aacaab97261d06..f83c1c256ada3b 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java @@ -188,9 +188,8 @@ public static void run(Application application, Class'."); } - } else if (ExceptionUtil.isAnyCauseInstanceOf(e, ConfigurationException.class)) { + } else if (rootCause instanceof ConfigurationException) { System.err.println(rootCause.getMessage()); - e.printStackTrace(); } else if (rootCause instanceof PreventFurtherStepsException && !StringUtil.isNullOrEmpty(rootCause.getMessage())) { System.err.println(rootCause.getMessage()); diff --git a/core/runtime/src/main/java/io/quarkus/runtime/util/ExceptionUtil.java b/core/runtime/src/main/java/io/quarkus/runtime/util/ExceptionUtil.java index b27f844b3cf06a..99fbf4fdce04ce 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/util/ExceptionUtil.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/util/ExceptionUtil.java @@ -86,17 +86,6 @@ public static Throwable getRootCause(Throwable exception) { return chain.isEmpty() ? null : chain.get(chain.size() - 1); } - public static boolean isAnyCauseInstanceOf(Throwable exception, Class classToCheck) { - Throwable curr = exception; - do { - if (classToCheck.isInstance(curr)) { - return true; - } - curr = curr.getCause(); - } while (curr != null); - return false; - } - /** * Creates and returns a new {@link Throwable} which has the following characteristics: *