From 030bc224e30699a91e33e27a6d9782803afbd0d4 Mon Sep 17 00:00:00 2001 From: Violeta Georgieva Date: Wed, 7 Mar 2018 17:06:57 +0200 Subject: [PATCH] Invert the check for ServletInputStream.isReady() When checking whether there is still request body the first method that should be checked is ServletInputStream.isReady() and then ServletInputStream.isFinished(). ServletInputStream.isReady() is the active method whereas the ServletInputStream.isFinished() is not. It is important to call ServletInputStream.isReady() because if it returns false it will schedule a dispatch and if the request body is already read it will send onAllDataRead event. Issue: SPR-16521 --- .../http/server/reactive/ServletServerHttpRequest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-web/src/main/java/org/springframework/http/server/reactive/ServletServerHttpRequest.java b/spring-web/src/main/java/org/springframework/http/server/reactive/ServletServerHttpRequest.java index 269b0403cb..4111a9e144 100644 --- a/spring-web/src/main/java/org/springframework/http/server/reactive/ServletServerHttpRequest.java +++ b/spring-web/src/main/java/org/springframework/http/server/reactive/ServletServerHttpRequest.java @@ -263,7 +263,7 @@ class ServletServerHttpRequest extends AbstractServerHttpRequest { @Override protected void checkOnDataAvailable() { - if (!this.inputStream.isFinished() && this.inputStream.isReady()) { + if (this.inputStream.isReady() && !this.inputStream.isFinished()) { onDataAvailable(); } }