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

isErrorPage() check fails in Tomcat when thrown exception has null message #5528

Open
BalusC opened this issue Nov 14, 2024 · 3 comments
Open

Comments

@BalusC
Copy link
Contributor

BalusC commented Nov 14, 2024

omnifaces/omnifaces#865

Unsure about other servers.

Solution: check exception itself as well.

Spec: https://jakarta.ee/specifications/faces/4.0/jakarta-faces-4.0#a404

Determine if this request is a postback or initial request by executing the following algorithm. Find the render-kit-id for the current request by calling calculateRenderKitId() on the Application’s ViewHandler. Get that RenderKit’s ResponseStateManager and call its isPostback() method, passing the current FacesContext. If the current request is an attempt by the servlet container to display a servlet error page, do not interpret the request as a postback, even if it is indeed a postback.

However neither Servlet nor Faces spec is sufficiently specific as to how exactly to detect that. The current impl only checks for the error message, which is in case of exceptions (status=500) the raw exception message. However, if the exception message itself is null, e.g. throw new RuntimeException() instead of throw new RuntimeException("peek-a-boo"), this check fails.

@BalusC BalusC changed the title isErrorPage() check fails in Tomcat when thrown exception has no message isErrorPage() check fails in Tomcat when thrown exception has null message Nov 14, 2024
@pizzi80
Copy link
Contributor

pizzi80 commented Nov 14, 2024

Confirmed, also opened a ticket for Tomcat

https://bz.apache.org/bugzilla/show_bug.cgi?id=69444

@pizzi80
Copy link
Contributor

pizzi80 commented Nov 14, 2024

I can submit a PR if you want

@pizzi80
Copy link
Contributor

pizzi80 commented Nov 20, 2024

Tomcat will fix this in

  • 11.0.x for 11.0.2 onwards
  • 10.1.x for 10.1.34 onwards
  • 9.0.x for 9.0.98 onwards

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

No branches or pull requests

2 participants