From 2480fab6f92bbbbe25a354e0c81caf1a26b23fd9 Mon Sep 17 00:00:00 2001 From: Steven Hawkins Date: Tue, 30 Jan 2024 13:02:00 -0500 Subject: [PATCH] fix: accounting for a null container (#26605) closes: #26604 Signed-off-by: Steve Hawkins --- .../runtime/integration/resteasy/ResteasyVertxProvider.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/integration/resteasy/ResteasyVertxProvider.java b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/integration/resteasy/ResteasyVertxProvider.java index a811898d2e..a67e043c79 100644 --- a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/integration/resteasy/ResteasyVertxProvider.java +++ b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/integration/resteasy/ResteasyVertxProvider.java @@ -23,6 +23,8 @@ import io.vertx.ext.web.RoutingContext; import org.jboss.resteasy.core.ResteasyContext; import org.keycloak.common.util.ResteasyProvider; +import java.util.Optional; + public class ResteasyVertxProvider implements ResteasyProvider { @Override @@ -30,7 +32,9 @@ public class ResteasyVertxProvider implements ResteasyProvider { R data = ResteasyContext.getContextData(type); if (data == null) { - RoutingContext contextData = Arc.container().instance(CurrentVertxRequest.class).get().getCurrent(); + RoutingContext contextData = Optional.ofNullable(Arc.container()) + .map(c -> c.instance(CurrentVertxRequest.class).get()).map(CurrentVertxRequest::getCurrent) + .orElse(null); if (contextData == null) { return null;