Repository: cxf Updated Branches: refs/heads/3.1.x-fixes 7cd6ca060 -> f31c8c6f2
[CXF-6957] Passing Fault to exception mappers if the cause is null Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/f31c8c6f Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/f31c8c6f Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/f31c8c6f Branch: refs/heads/3.1.x-fixes Commit: f31c8c6f2dea7bc3f717388d6e6e217e3321febb Parents: 7cd6ca0 Author: Sergey Beryozkin <[email protected]> Authored: Fri Jul 1 12:31:27 2016 +0100 Committer: Sergey Beryozkin <[email protected]> Committed: Fri Jul 1 12:38:29 2016 +0100 ---------------------------------------------------------------------- .../src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/f31c8c6f/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java ---------------------------------------------------------------------- diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java index ac445d9..32b6243 100644 --- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java +++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java @@ -134,7 +134,7 @@ public class JAXRSInvoker extends AbstractInvoker { try { return handleFault(new Fault(t), exchange.getInMessage(), null, null); } catch (Fault ex) { - ar.setUnmappedThrowable(ex.getCause()); + ar.setUnmappedThrowable(ex.getCause() == null ? ex : ex.getCause()); if (isSuspended(exchange)) { ar.reset(); exchange.getInMessage().getInterceptorChain().unpause(); @@ -197,7 +197,8 @@ public class JAXRSInvoker extends AbstractInvoker { } catch (Fault ex) { Object faultResponse; if (asyncResponse != null) { - faultResponse = handleAsyncFault(exchange, asyncResponse, ex.getCause()); + faultResponse = handleAsyncFault(exchange, asyncResponse, + ex.getCause() == null ? ex : ex.getCause()); } else { faultResponse = handleFault(ex, inMessage, cri, methodToInvoke); } @@ -326,7 +327,8 @@ public class JAXRSInvoker extends AbstractInvoker { cri.getServiceClass().getName()); LOG.severe(errorM.toString()); } - Response excResponse = JAXRSUtils.convertFaultToResponse(ex.getCause(), inMessage); + Response excResponse = + JAXRSUtils.convertFaultToResponse(ex.getCause() == null ? ex : ex.getCause(), inMessage); if (excResponse == null) { inMessage.getExchange().put(Message.PROPOGATE_EXCEPTION, ExceptionUtils.propogateException(inMessage));
