From b17cd68674d1b0aab1c90856345722495df4be99 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Mon, 2 May 2022 09:11:05 +0300 Subject: [PATCH] Ignore ContextNotActiveException in RESTEasy Reactive when clearing request Fixes: #25229 --- .../reactive/server/runtime/QuarkusCurrentRequest.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/QuarkusCurrentRequest.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/QuarkusCurrentRequest.java index 89622da955cc23..6cabc512026145 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/QuarkusCurrentRequest.java +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/QuarkusCurrentRequest.java @@ -1,5 +1,7 @@ package io.quarkus.resteasy.reactive.server.runtime; +import javax.enterprise.context.ContextNotActiveException; + import org.jboss.resteasy.reactive.server.core.CurrentRequest; import org.jboss.resteasy.reactive.server.core.ResteasyReactiveRequestContext; @@ -22,8 +24,12 @@ public ResteasyReactiveRequestContext get() { @Override public void set(ResteasyReactiveRequestContext set) { if (set == null) { - currentVertxRequest.setOtherHttpContextObject(null); - currentVertxRequest.setCurrent(null); + try { + currentVertxRequest.setOtherHttpContextObject(null); + currentVertxRequest.setCurrent(null); + } catch (ContextNotActiveException ignored) { + + } } else { currentVertxRequest.setOtherHttpContextObject(set); currentVertxRequest.setCurrent(set.unwrap(RoutingContext.class));