Class CatchAllExceptionMapper

java.lang.Object
org.apache.tika.server.core.CatchAllExceptionMapper
All Implemented Interfaces:
jakarta.ws.rs.ext.ExceptionMapper<Throwable>

@Provider public class CatchAllExceptionMapper extends Object implements jakarta.ws.rs.ext.ExceptionMapper<Throwable>
Last-resort mapper for exceptions no more specific mapper handles, so they don't fall through to CXF's fault chain, which echoes raw exception messages to the caller.

The WebApplicationException passthrough is load-bearing, not defensive. CXF returns a WAE's own response without consulting any mapper only when that response already carries an entity and the WAE has no cause (support.wae.spec.optimization). Every other WAE -- 404 and 405 from routing, an entity-less 204 or 503 a resource throws -- goes to mapper selection, where default.wae.mapper.least.specific sorts CXF's own WAE mapper last and hands it to this ExceptionMapper<Throwable>. Drop the branch and each of those becomes a 500 trace.

CXF's mapper logged what it handled; taking that over means logging here, or 404s and 405s vanish from the server log.

  • Constructor Details

    • CatchAllExceptionMapper

      public CatchAllExceptionMapper(ExceptionReporting exceptionReporting)
  • Method Details

    • toResponse

      public jakarta.ws.rs.core.Response toResponse(Throwable t)
      Specified by:
      toResponse in interface jakarta.ws.rs.ext.ExceptionMapper<Throwable>