diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java index 421f1e191f1532..d181e33c5a1f74 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java @@ -71,7 +71,6 @@ import io.quarkus.gizmo.ClassTransformer; import io.quarkus.gizmo.FieldCreator; import io.quarkus.gizmo.FieldDescriptor; -import io.quarkus.gizmo.IfThenElse; import io.quarkus.gizmo.MethodCreator; import io.quarkus.gizmo.MethodDescriptor; import io.quarkus.gizmo.ResultHandle; @@ -89,7 +88,6 @@ import io.quarkus.runtime.annotations.QuarkusMain; import io.quarkus.runtime.appcds.AppCDSUtil; import io.quarkus.runtime.configuration.ConfigUtils; -import io.quarkus.runtime.configuration.ConfigurationException; import io.quarkus.runtime.configuration.ProfileManager; import io.quarkus.runtime.util.StepTiming; @@ -330,14 +328,7 @@ void build(List staticInitTasks, } cb.invokeVirtualMethod(ofMethod(StartupContext.class, "close", void.class), startupContext); - - ResultHandle caughtException = cb.getCaughtException(); - - IfThenElse ifThenElse = cb.ifThenElse(cb.instanceOf(caughtException, ConfigurationException.class)); - BytecodeCreator ifThen = ifThenElse.then(); - ifThen.throwException(caughtException); - BytecodeCreator elseThen = ifThenElse.elseThen(); - elseThen.throwException(RuntimeException.class, "Failed to start quarkus", cb.getCaughtException()); + cb.throwException(RuntimeException.class, "Failed to start quarkus", cb.getCaughtException()); mv.returnValue(null); // Application class: stop method 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 8276aacfca38bc..981b7c8497bdf5 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java @@ -156,9 +156,11 @@ public static void run(Application application, Class { - assertEquals(throwable.getClass().getName(), ConfigurationException.class.getName()); + assertTrue(throwable instanceof ConfigurationException); assertTrue(throwable.getMessage().contains("quarkus.security.events.enabled")); }); diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/config/ConfigEnabledFalseAndActiveTrueTest.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/config/ConfigEnabledFalseAndActiveTrueTest.java index f6caa3323c6bc7..635243010156eb 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/config/ConfigEnabledFalseAndActiveTrueTest.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/config/ConfigEnabledFalseAndActiveTrueTest.java @@ -17,7 +17,7 @@ public class ConfigEnabledFalseAndActiveTrueTest { .overrideConfigKey("quarkus.hibernate-orm.enabled", "false") .overrideConfigKey("quarkus.hibernate-orm.active", "true") .assertException(throwable -> assertThat(throwable) - .matches(t -> t.getClass().getName().equals(ConfigurationException.class.getName())) + .isInstanceOf(ConfigurationException.class) .hasMessageContaining( "Hibernate ORM activated explicitly for persistence unit '', but the Hibernate ORM extension was disabled at build time", "If you want Hibernate ORM to be active at runtime, you must set 'quarkus.hibernate-orm.enabled' to 'true' at build time", diff --git a/extensions/narayana-jta/deployment/src/test/java/io/quarkus/narayana/quarkus/TransactionJdbcObjectStoreValidationFailureTest.java b/extensions/narayana-jta/deployment/src/test/java/io/quarkus/narayana/quarkus/TransactionJdbcObjectStoreValidationFailureTest.java index b3125929dbd6f0..a0515c8128f919 100644 --- a/extensions/narayana-jta/deployment/src/test/java/io/quarkus/narayana/quarkus/TransactionJdbcObjectStoreValidationFailureTest.java +++ b/extensions/narayana-jta/deployment/src/test/java/io/quarkus/narayana/quarkus/TransactionJdbcObjectStoreValidationFailureTest.java @@ -24,7 +24,7 @@ public class TransactionJdbcObjectStoreValidationFailureTest { .setForcedDependencies(List.of(Dependency.of("io.quarkus", "quarkus-jdbc-h2", Version.getVersion()))) .assertException(t -> { Throwable rootCause = ExceptionUtil.getRootCause(t); - if (rootCause.getClass().getName().equals(ConfigurationException.class.getName())) { + if (rootCause instanceof ConfigurationException) { assertTrue(rootCause.getMessage().contains( "The Narayana JTA extension is configured to use the datasource 'test' but that datasource is not configured.")); } else { diff --git a/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/OpaqueTokenVerificationWithUserInfoValidationTest.java b/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/OpaqueTokenVerificationWithUserInfoValidationTest.java index 6ee3d5c8361e05..1c53cc39659047 100644 --- a/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/OpaqueTokenVerificationWithUserInfoValidationTest.java +++ b/extensions/oidc/deployment/src/test/java/io/quarkus/oidc/test/OpaqueTokenVerificationWithUserInfoValidationTest.java @@ -24,7 +24,7 @@ public class OpaqueTokenVerificationWithUserInfoValidationTest { Throwable e = t; ConfigurationException te = null; while (e != null) { - if (e.getClass().getName().equals(ConfigurationException.class.getName())) { + if (e instanceof ConfigurationException) { te = (ConfigurationException) e; break; }