cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Porras <>
Subject Re: ExceptionMapper choosing the wrong mapper
Date Tue, 06 Sep 2011 21:13:34 GMT
On Tue, Sep 6, 2011 at 4:12 PM, Alex Porras <> wrote:

> What is happening is that when FooException is thrown in the
> application, it is being handled by BarExceptionMapper.

I believe I have found the solution.  Despite the child exception
mappers specifying a generic type required by the parent (abstract)
exception mapper (which implements ExceptionMapper), each child class
also needs to include a "implements ExceptionMapper<T>" declaration,
to prevent CXF from bubbling up to the base interface implementation
declaration and using that class's generic type.

Thus, my exception mapper hierarchy is now:

(abstract) BaseRuntimeExceptionMapper <T extends BaseRuntimeException>
FooExceptionMapper extends BaseRuntimeExceptionMapper<FooException>
implements ExceptionMapper<FooException>
BarExceptionMapper extends

This seems a little repetitive, but I think it makes sense given the
route that CXF seems to be using to determine the exception type.

Hope this helps someone else!


View raw message