You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2014/08/13 12:14:12 UTC
[jira] [Resolved] (CXF-5943) Throw error in exceptionmapper
[ https://issues.apache.org/jira/browse/CXF-5943?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sergey Beryozkin resolved CXF-5943.
-----------------------------------
Resolution: Fixed
Fix Version/s: 3.1.0
3.0.2
2.7.13
Assignee: Sergey Beryozkin
thanks for the patch
> 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
> Assignee: Sergey Beryozkin
> Fix For: 2.7.13, 3.0.2, 3.1.0
>
> 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)