Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 8052f805a -> 6de58426b


[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/6de58426
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/6de58426
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/6de58426

Branch: refs/heads/3.0.x-fixes
Commit: 6de58426b53784c921924df2fd252056b0237128
Parents: 8052f80
Author: Sergey Beryozkin <[email protected]>
Authored: Fri Jul 1 12:31:27 2016 +0100
Committer: Sergey Beryozkin <[email protected]>
Committed: Fri Jul 1 12:39:40 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/6de58426/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 ad2c627..14d9aea 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();
@@ -208,7 +208,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);
             }
@@ -321,7 +322,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));

Reply via email to