Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpInput.setReadListener should throw IllegalStateException if async not started #4794

Closed
janbartel opened this issue Apr 21, 2020 · 1 comment · Fixed by #4796 or #4804
Closed

HttpInput.setReadListener should throw IllegalStateException if async not started #4794

janbartel opened this issue Apr 21, 2020 · 1 comment · Fixed by #4796 or #4804
Assignees
Labels
Specification For all industry Specifications (IETF / Servlet / etc) TCK For various Specification Test Compatibility Kits (eg: Servlet, WebSocket, HTTP/2, etc)

Comments

@janbartel
Copy link
Contributor

According to the javadoc for ServletInputStream:

    @exception IllegalStateException if one of the following conditions is true
       <ul>
        <li>the associated request is neither upgraded nor the async started
        <li>setReadListener is called more than once within the scope of the same  request.
      </ul>

The tck has a test for this, see nioInputTest2: https://github.com/eclipse-ee4j/jakartaee-tck/blob/5b126670c92e6ab800d35100ad1dfa2a4488daa7/src/com/sun/ts/tests/servlet/api/javax_servlet_http/readlistener1/TestServlet.java

@janbartel janbartel added Specification For all industry Specifications (IETF / Servlet / etc) TCK For various Specification Test Compatibility Kits (eg: Servlet, WebSocket, HTTP/2, etc) labels Apr 21, 2020
@janbartel janbartel self-assigned this Apr 21, 2020
janbartel added a commit that referenced this issue Apr 21, 2020
Signed-off-by: Jan Bartel <janb@webtide.com>
janbartel added a commit that referenced this issue Apr 21, 2020
Signed-off-by: Jan Bartel <janb@webtide.com>
janbartel added a commit that referenced this issue Apr 21, 2020
* Issue #4794 HttpInput.setReadListener should check async state

Signed-off-by: Jan Bartel <janb@webtide.com>
@janbartel janbartel reopened this Apr 23, 2020
janbartel added a commit that referenced this issue Apr 23, 2020
Signed-off-by: Jan Bartel <janb@webtide.com>
@janbartel
Copy link
Contributor Author

The tck test shows up a subtlety: setReadListener can only be called just after Request.startAsync() has been called, but BEFORE the request has returned to the container. My original fix didn't take account of this difference so reopening to change the method that is tested from HttpChannelState.isAsync() to HttpChannelState.isAsyncStarted()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Specification For all industry Specifications (IETF / Servlet / etc) TCK For various Specification Test Compatibility Kits (eg: Servlet, WebSocket, HTTP/2, etc)
Projects
None yet
1 participant