cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "iris ding (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-5943) Throw error in exceptionmapper
Date Wed, 13 Aug 2014 07:32:12 GMT

    [ 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)

Mime
View raw message