Commit 7298b2dc authored by Andy Wilkinson's avatar Andy Wilkinson

Set value of javax.servlet.error.exception_type to a Class not a String

Previously, ErrorPageFilter set the value of
javax.servlet.error.exception_type to be the name of the exception,
(a java.lang.String). This commit changes it to be a java.lang.Class
as required by the Servlet spec.

Closes gh-7925
parent 6f7d1de1
......@@ -179,7 +179,7 @@ public class ErrorPageFilter implements Filter, ErrorPageRegistry {
}
setErrorAttributes(request, 500, ex.getMessage());
request.setAttribute(ERROR_EXCEPTION, ex);
request.setAttribute(ERROR_EXCEPTION_TYPE, ex.getClass().getName());
request.setAttribute(ERROR_EXCEPTION_TYPE, ex.getClass());
response.reset();
response.sendError(500, ex.getMessage());
request.getRequestDispatcher(path).forward(request, response);
......
......@@ -262,7 +262,7 @@ public class ErrorPageFilterTests {
assertThat(this.request.getAttribute(RequestDispatcher.ERROR_MESSAGE))
.isEqualTo("BAD");
assertThat(this.request.getAttribute(RequestDispatcher.ERROR_EXCEPTION_TYPE))
.isEqualTo(RuntimeException.class.getName());
.isEqualTo(RuntimeException.class);
assertThat(this.request.getAttribute(RequestDispatcher.ERROR_REQUEST_URI))
.isEqualTo("/test/path");
assertThat(this.response.isCommitted()).isTrue();
......@@ -319,7 +319,7 @@ public class ErrorPageFilterTests {
assertThat(this.request.getAttribute(RequestDispatcher.ERROR_MESSAGE))
.isEqualTo("BAD");
assertThat(this.request.getAttribute(RequestDispatcher.ERROR_EXCEPTION_TYPE))
.isEqualTo(IllegalStateException.class.getName());
.isEqualTo(IllegalStateException.class);
assertThat(this.request.getAttribute(RequestDispatcher.ERROR_REQUEST_URI))
.isEqualTo("/test/path");
assertThat(this.response.isCommitted()).isTrue();
......@@ -493,7 +493,7 @@ public class ErrorPageFilterTests {
assertThat(this.request.getAttribute(RequestDispatcher.ERROR_MESSAGE))
.isEqualTo("BAD");
assertThat(this.request.getAttribute(RequestDispatcher.ERROR_EXCEPTION_TYPE))
.isEqualTo(RuntimeException.class.getName());
.isEqualTo(RuntimeException.class);
assertThat(this.request.getAttribute(RequestDispatcher.ERROR_REQUEST_URI))
.isEqualTo("/test/path");
assertThat(this.response.isCommitted()).isTrue();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment