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
This commit is contained in:
Violeta Georgieva 2018-03-07 17:06:57 +02:00 committed by Rossen Stoyanchev
parent 20287e0cb0
commit 030bc224e3
1 changed files with 1 additions and 1 deletions

View File

@ -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();
}
}