Error page lookup does not conform to the servlet spec #156

Closed
VsevolodGolovanov opened this Issue Aug 5, 2015 · 1 comment

Projects

None yet

2 participants

@VsevolodGolovanov

WebXml#findErrorPageLocation is incorrect, because it doesn't satisfy the rule of the servlet spec: The closest match in the class hierarchy wins. WebXml uses the first encountered superclass instead.
Here is how Undertow does it:

String location = null;
for (Class c = exception.getClass(); c != null && location == null; c = c.getSuperclass()) {
    location = exceptionMappings.get(c);
}

https://github.com/undertow-io/undertow/blob/master/servlet/src/main/java/io/undertow/servlet/core/ErrorPages.java

WebXml also doesn't do the unwrap the ServletException and do a second pass step, but I guess this is intentional, because WebXml#findErrorPageLocation is intended to be called inside the Servlet#service execution, before ServletException wrapping could occur.

@BalusC BalusC closed this in 89b677d Aug 5, 2015
@BalusC
Member
BalusC commented Aug 5, 2015

Fix is available in today's snapshot. Thank you for reporting!

@BalusC BalusC added the bug label Oct 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment