You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "iris ding (JIRA)" <ji...@apache.org> on 2014/08/13 04:43:12 UTC

[jira] [Created] (CXF-5943) Throw error in exceptionmapper

iris ding created CXF-5943:
------------------------------

             Summary: Throw error in exceptionmapper
                 Key: CXF-5943
                 URL: https://issues.apache.org/jira/browse/CXF-5943
             Project: CXF
          Issue Type: Bug
          Components: JAX-RS
    Affects Versions: 3.0.0
            Reporter: iris ding


In ExceptionUtils.convertFaultToResponse(), it only catches Exception.  So CXF fails to process the request if we throw Error in our own XXXExceptionMapper. The definition of ExceptionMapper is: 
Interface ExceptionMapper<E extends Throwable> So I think we should catch Throwable instead. 

   if (response == null) { 
            ExceptionMapper<T>  mapper = 
                ServerProviderFactory.getInstance(inMessage).createExceptionMapper(ex.getClass(), inMessage); 
            if (mapper != null) { 
                try { 
                    response = mapper.toResponse(ex); 
                } catch (Exception mapperEx) { 
                    inMessage.getExchange().put(JAXRSUtils.EXCEPTION_FROM_MAPPER, "true"); 
                    mapperEx.printStackTrace(); 
                    return Response.serverError().build(); 
                } 
            } 
        } 
        } 



--
This message was sent by Atlassian JIRA
(v6.2#6252)