fix: accounting for a null container (#26605)

closes: #26604

Signed-off-by: Steve Hawkins <shawkins@redhat.com>
This commit is contained in:
Steven Hawkins 2024-01-30 13:02:00 -05:00 committed by GitHub
parent fa948f37e0
commit 2480fab6f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;