Skip to content

Documentation/Implementation issue for the default exception mapper in Jersey 3.1.0 #5192

@zUniQueX

Description

@zUniQueX

Hi Jersey team,

the current documentation for the default exception mapper doesn't correctly explain the behaviour of Jersey 3.1.0.

Processing of the default Exception Mapper occurs at the very end of the exception processing chain. It is invoked only if nothing else in the chain was invoked before.

The JAX-RS spec isn't that restrictive on the processing of the default exception mapper, it only states that a mapper for a Throwable has to be provided.

While upgrading an existing application to Jersey 3.1.0 I experienced that an other exception mapper for the Throwable type won't get invoked, but rather the default exception mapper.

This behaviour should be caused here. The collection for the exception mappers is a Set, so the default exception mapper may be processed earlier than an other one for Throwable.

From the perspective of the spec, the current implementation is fine and only the documentation is misleading. But the behaviour of the current Jersey documentation is the one to prefer IMHO. So I'd suggest to use a list and add the default exception mapper as the last element.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions