jakartaee / servlet

Jakarta Servlet
https://eclipse.org/ee4j/servlet
Other
250 stars 79 forks source link

TCK for Servlet 6.1 invalid error code in servlet.tck.api.jakarta_servlet_http.httpservletresponse #660

Closed janbartel closed 1 week ago

janbartel commented 2 weeks ago

https://github.com/jakartaee/servlet/blob/master/tck/tck-runtime/src/main/java/servlet/tck/api/jakarta_servlet_http/httpservletresponse/servlet_jsh_httpservletresponse_web.xml#L74 maps error code 411 to servlet.tck.api.jakarta_servlet_http.httpservletresponse.ServletErrorPage, however the server side part of the test at https://github.com/jakartaee/servlet/blob/master/tck/tck-runtime/src/main/java/servlet/tck/common/response/ResponseTests.java#L1079 is doing a sendError call for HttpServletResponse.SC_GONE, which is equivalent to 410, so the ServletErrorPage will never be invoked.

The same error also affects:

markt-asf commented 1 week ago

I do not believe that it is intended that this test uses ServletErrorPage.

ServletErrorPage returns a plain text response but this test is expecting a content type of text\html.

The test expects the error page to echo the message passed to sendError(int sc, String msg) but ServletErrorPage only echos this message if it contains the text error page invoked which it does not in this case.

The test is only relying on documented behaviour of HttpServletResponse.sendError(int, String) (use the provided status code, send on HTML response, send the message in the response) and does not require a custom error page for this.

The use of status code 411 appears to be solely for the sendError_StringErrorPageTest.

I am curious why you think this test should invoke ServletErrorPage.

I'll leave this open for a few days in case I have missed something but unless we reach consensus that this test should call ServletErrroPage I intend to close this issue with no further action.

janbartel commented 1 week ago

@markt-asf oops my bad. I was confused by the similarity of the error code used in the test and the error code mapped for the error page - looked like a typo. Closing.