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

Default exception mapper processing #5193

Merged

Conversation

zUniQueX
Copy link
Contributor

Fixes #5192

Problem

The default exception mapper is registered by default in Jersey 3.1.0 and is made avilable through ExceptionMapperFactory. If an other exception mapper is registered as ExceptionMapper<Throwable>, the first one found will be used. This can lead to a reordering issue where the default exception mapper will be found first.

The ServerRuntime additionally won't handle exceptions, if the default exception mapper is returned by ExceptionMapperFactory.findMapping(...) (see here) and instead will handle the exception with the default exception mapper in a separate method.

Solution

The proposed change in this PR is to avoid registration of the default exception mapper in the ExceptionMapperFactory. This will leave the exception mapper resolving logic as it was in Jersey 3.0.x and provide users the ability to register an ExceptionMapper<Throwable>. If none is set, the ServerRuntime will eventually handle the exception afterwards because no exception mapper is found.

…erFactory to avoid skipping an other exception mapper for Throwable
@zUniQueX zUniQueX force-pushed the default-exception-mapper-processing branch from 261d3d9 to 8c97e2e Compare November 12, 2022 16:45
@jansupol jansupol merged commit 4f9b6f5 into eclipse-ee4j:3.1 Nov 14, 2022
@senivam senivam added this to the 3.1.1 milestone Nov 14, 2022
@zUniQueX zUniQueX deleted the default-exception-mapper-processing branch November 14, 2022 19:14
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.

3 participants