From 14108c8e58214164cea5e3304106a3a00f9a5258 Mon Sep 17 00:00:00 2001 From: Ludovic Orban Date: Thu, 11 Feb 2021 10:24:48 +0100 Subject: [PATCH] set the read listener only after all checks are done Signed-off-by: Ludovic Orban --- .../src/main/java/org/eclipse/jetty/server/HttpInput.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpInput.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpInput.java index 8336b244334..0b879d5ae21 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpInput.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpInput.java @@ -210,10 +210,10 @@ public class HttpInput extends ServletInputStream implements Runnable LOG.debug("setting read listener to {} {}", readListener, this); if (_readListener != null) throw new IllegalStateException("ReadListener already set"); - _readListener = Objects.requireNonNull(readListener); //illegal if async not started if (!_channelState.isAsyncStarted()) throw new IllegalStateException("Async not started"); + _readListener = Objects.requireNonNull(readListener); _contentProducer = _asyncContentProducer; // trigger content production