From f77e47a1c11d240586f9126f41c1b6e2c68727a6 Mon Sep 17 00:00:00 2001 From: Keith Lustria <34235093+klustria@users.noreply.github.com> Date: Fri, 18 Nov 2022 10:12:15 -0800 Subject: [PATCH] NullPointerException when there is an illegal character in the request (#5470) (#5472) --- .../io/helidon/reactive/webserver/ForwardingHandler.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reactive/webserver/webserver/src/main/java/io/helidon/reactive/webserver/ForwardingHandler.java b/reactive/webserver/webserver/src/main/java/io/helidon/reactive/webserver/ForwardingHandler.java index 55c02b34a8e..8062051a836 100644 --- a/reactive/webserver/webserver/src/main/java/io/helidon/reactive/webserver/ForwardingHandler.java +++ b/reactive/webserver/webserver/src/main/java/io/helidon/reactive/webserver/ForwardingHandler.java @@ -340,6 +340,9 @@ private boolean channelReadHttpRequest(ChannelHandlerContext ctx, Context reques // New request ID long requestId = REQUEST_ID_GENERATOR.incrementAndGet(); + + requestEntityAnalyzed = new CompletableFuture<>(); + // If a problem with the request URI, return 400 response BareRequestImpl bareRequest; try { @@ -395,8 +398,6 @@ private boolean channelReadHttpRequest(ChannelHandlerContext ctx, Context reques prevRequestFuture = null; } - requestEntityAnalyzed = new CompletableFuture<>(); - //If the keep alive is not set, we know we will be closing the connection if (!HttpUtil.isKeepAlive(requestContext.request())) { this.requestEntityAnalyzed.complete(ChannelFutureListener.CLOSE);