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

Issue #5939 Use unwrapped exception as exception type for error handling #5940

Closed
wants to merge 4 commits into from

Conversation

olamy
Copy link
Member

@olamy olamy commented Feb 3, 2021

#5939
Signed-off-by: olivier lamy oliver.lamy@gmail.com

Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
@@ -75,7 +75,19 @@ public String getErrorPage(HttpServletRequest request)
if (errorPage != null)
matchedThrowable = exClass;

th = (th instanceof ServletException) ? ((ServletException)th).getRootCause() : null;
if (th instanceof ServletException)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we change the ERROR_EXCEPTION here, then the LOG.DEBUG generated down at line 141/142 will be wrong.

Also, presumably jetty has had this behaviour for a very long time, so I'm wary about changing it ... @gregw WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to provide a compliance mode to at least be able to switch back to the old behaviour, as we have offered this way for some time.

Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
th = ((ServletException)th).getRootCause();
if (th != null)
{
request.setAttribute(Dispatcher.ERROR_EXCEPTION_TYPE, th.getClass());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is correct to do this here as we are walking the hierarchy.
I think the resetting of Dispatcher.ERROR_EXCEPTION_TYPE (and probably Dispatcher.ERROR_EXCEPTION) should be done below, only if we have an error page AND we are not in the compliance mode.

@gregw gregw linked an issue Feb 8, 2021 that may be closed by this pull request
@gregw
Copy link
Contributor

gregw commented Feb 8, 2021

@olamy Do you want me to add the compliance mode switch for this?

@gregw
Copy link
Contributor

gregw commented Feb 8, 2021

Also this needs to be fixed in 10 and merged to 11. We don't want 11 to diverge from 10

@gregw gregw changed the base branch from jetty-11.0.x to jetty-10.0.x February 8, 2021 19:07
@gregw gregw changed the base branch from jetty-10.0.x to jetty-11.0.x February 8, 2021 19:07
@gregw
Copy link
Contributor

gregw commented Feb 8, 2021

replaced by #5958

@gregw gregw closed this Feb 8, 2021
@olamy olamy deleted the jetty-11.0.x_wrapper_exception_type branch February 11, 2021 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use unwrapped exception as exception type for error handling
3 participants