Skip to content

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

@BalusC

Description

@BalusC

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions