[
https://issues.apache.org/jira/browse/CXF-5348?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14659714#comment-14659714
]
Tim Gates commented on CXF-5348:
--------------------------------
I'm using 3.1.2 (for which this bug is mostly fixed), but it seems that a
custom WebApplicationException mapper which extends an abstract superclass will
not be preferred over the default one. If my custom mapper implements
ExceptionMapper<WebApplicationException>, then all is fine.
> Exception mappers implementing ExceptionMapper through an abstract class are
> not mapped to the declared exception
> ------------------------------------------------------------------------------------------------------------------
>
> Key: CXF-5348
> URL: https://issues.apache.org/jira/browse/CXF-5348
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS
> Affects Versions: 2.7.7
> Reporter: Fabien Thouny
> Assignee: Sergey Beryozkin
> Priority: Minor
> Fix For: 3.0.0-milestone2, 2.7.10
>
> Attachments: hierarchical-exception-mapper.zip
>
>
> If we consider the following exception mapper, all Throwables will be mapped
> instead of only the SomeClientExceptions :
> {code}
> @Provider
> public class SomeClientExceptionMapper extends
> AbstractBadRequestExceptionMapper<SomeClientException> {}
> abstract class AbstractBadRequestExceptionMapper<T extends Throwable>
> implements ExceptionMapper<T> {
> @Override
> public Response toResponse(T exception) {
> return
> Response.status(Status.BAD_REQUEST).entity(exception.getMessage()).build();
> }
> }
> {code}
> Please find attached, a sample project with some ITs showing the problem.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)