Hi Mikko
I'm just CC-ing to the users list so that I can acknowledge that your
hint did help me to resolve this issue.
I'd normally be quite nervous about changes like this however adding an
additional check as you suggest does seem to be a safe one, all the
tests pass for me :-)
I won't merge to 2.3.x, can do it later if we can see the update is
definitely 100% ok...
Thanks, Sergey
On 03/02/12 14:03, [email protected] wrote:
<quote author='Sergey Beryozkin-5'>
private static class RuntimeExceptionMapper1
extends AbstractTestExceptionMapper<RuntimeException> {
}
private static class RuntimeExceptionMapper2
extends AbstractTestExceptionMapper<WebApplicationException> {
}
private static class AbstractTestExceptionMapper<T extends
RuntimeException>
implements ExceptionMapper<T> {
@Override
public Response toResponse(T arg0) {
// TODO Auto-generated method stub
return null;
}
}
Any idea on how to get to say "WebApplicationException" which is visible
in the code at least in
"AbstractTestExceptionMapper<WebApplicationException>".
I'm wondering if it is even available at the runtime,
</quote>
Quoted from:
http://cxf.547215.n5.nabble.com/ExceptionMapper-choosing-the-wrong-mapper-tp4775881p5108024.html
I think you should be able to do something like this:
ExceptionMapper<?> exceptionMapper = new RuntimeExceptionMapper2();
ParameterizedType parameterizedType = (ParameterizedType)
exceptionMapper.getClass().getGenericSuperclass();
Class parameterizedExceptionClass = (Class)
parameterizedType.getActualTypeArguments()[0];
Regards,
-Mikko-