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 09:32:12 UTC

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

    [ https://issues.apache.org/jira/browse/CXF-5943?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14095243#comment-14095243 ] 

iris ding commented on CXF-5943:
--------------------------------

Simple modification, just 
From: 
catch (Exception mapperEx)

To:
catch (Throwable mapperEx)

> 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
>         Attachments: cxf-5943.patch
>
>
> 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)