diff --git a/http-server/src/main/java/io/micronaut/http/server/RouteExecutor.java b/http-server/src/main/java/io/micronaut/http/server/RouteExecutor.java index 60add7aec6e..72263400ed1 100644 --- a/http-server/src/main/java/io/micronaut/http/server/RouteExecutor.java +++ b/http-server/src/main/java/io/micronaut/http/server/RouteExecutor.java @@ -75,6 +75,7 @@ import java.time.LocalDateTime; import java.util.Iterator; import java.util.List; +import java.util.Objects; import java.util.Optional; import java.util.concurrent.Callable; import java.util.concurrent.CompletableFuture; @@ -509,7 +510,7 @@ ExecutionFlow> createResponseForBody(PropagatedContext propagate } else if (body instanceof String) { // Micro-optimization for String values response = forStatus(routeInfo, null).body(body); - } else if (body instanceof HttpStatus httpStatus) { + } else if (body instanceof HttpStatus httpStatus) { response = HttpResponse.status(httpStatus); } if (response != null) { @@ -521,7 +522,7 @@ ExecutionFlow> createResponseForBody(PropagatedContext propagate outgoingResponse = ReactiveExecutionFlow.fromPublisher( ReactivePropagation.propagate( propagatedContext, - fromReactiveExecute(propagatedContext, request, body, routeInfo) + fromReactiveExecute(propagatedContext, request, Objects.requireNonNull(body), routeInfo) ) ); } else { diff --git a/http/src/main/java/io/micronaut/http/filter/InternalHttpFilter.java b/http/src/main/java/io/micronaut/http/filter/InternalHttpFilter.java index 78333f5493d..c263a1a1127 100644 --- a/http/src/main/java/io/micronaut/http/filter/InternalHttpFilter.java +++ b/http/src/main/java/io/micronaut/http/filter/InternalHttpFilter.java @@ -17,6 +17,7 @@ import io.micronaut.core.annotation.Internal; import io.micronaut.core.annotation.NonNull; +import io.micronaut.core.annotation.Nullable; import io.micronaut.core.execution.ExecutionFlow; import io.micronaut.core.order.Ordered; @@ -96,7 +97,7 @@ default ExecutionFlow processRequestFilter(@NonNull FilterContext */ @NonNull default ExecutionFlow processResponseFilter(@NonNull FilterContext context, - @NonNull Throwable exceptionToFilter) { + @Nullable Throwable exceptionToFilter) { if (!isFiltersResponse()) { throw new IllegalStateException("Filtering response is not supported!"); }