In my JAXRS app, I have 2 ExceptionMapperregistered as@Provider
public class MyExceptionMapper implements ExceptionMapper<Exception> {...}
public class MyCustomRuntimeExceptionMapper implements ExceptionMapper<MyCustomRuntimeException> {...}
When my application throws a new one MyCustomRuntimeException, the exception gets inside MyExceptionMapper, although (says JAX-RS spec) it should be caught inside MyCustomRuntimeExceptionMapper.
Here is what JAXRS says -
JAX-RS also supports inheritance inheritance. When an exception occurs, JAX-RS will first try to find the ExceptionMapper for this type of exception. If he cannot find it, he will look for a map that can handle the superclass of the exception class. This will continue until there are no more superclasses to match.
Does anyone know what is going on here?