cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [2/3] git commit: [CXF-5630] If the client sets the ROBUST_ONEWAY flag, process any fault returned.
Date Fri, 21 Mar 2014 17:20:49 GMT
[CXF-5630] If the client sets the ROBUST_ONEWAY flag, process any fault returned.


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/ad1edc90
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/ad1edc90
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/ad1edc90

Branch: refs/heads/2.7.x-fixes
Commit: ad1edc908157665fe9f28243e2d4bf1840938444
Parents: 8e5d8b5
Author: Daniel Kulp <dkulp@apache.org>
Authored: Fri Mar 21 13:17:46 2014 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Fri Mar 21 13:20:10 2014 -0400

----------------------------------------------------------------------
 .../apache/cxf/transport/http/HTTPConduit.java  | 21 ++++++++++----------
 .../interceptor/InterceptorFaultTest.java       |  7 ++++---
 2 files changed, 15 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/ad1edc90/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
index cbe6566..ab4cdb6 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
@@ -1512,7 +1512,7 @@ public abstract class HTTPConduit
         }
         
         /**
-         * This predicate returns true iff the exchange indicates 
+         * This predicate returns true if the exchange indicates 
          * a oneway MEP.
          * 
          * @param exchange The exchange in question
@@ -1521,13 +1521,16 @@ public abstract class HTTPConduit
             return exchange != null && exchange.isOneWay();
         }
         
-        private boolean doProcessResponse(Message message) {
+        private boolean doProcessResponse(Message message, int responseCode) {
             // 1. Not oneWay
             if (!isOneway(message.getExchange())) {
                 return true;
             }
-            // 2. Context property
-            return MessageUtils.getContextualBoolean(message, Message.PROCESS_ONEWAY_RESPONSE,
false);
+            // 2. Robust OneWays could have a fault
+            if (responseCode == 500 && MessageUtils.getContextualBoolean(message,
Message.ROBUST_ONEWAY, false)) {
+                return true;
+            }
+            return false;
         }
 
         protected void handleResponseInternal() throws IOException {
@@ -1561,10 +1564,11 @@ public abstract class HTTPConduit
             updateResponseHeaders(inMessage);
             inMessage.put(Message.RESPONSE_CODE, responseCode);
 
-            if (isOneway(exchange)
+            if (!doProcessResponse(outMessage, responseCode)
                 || HttpURLConnection.HTTP_ACCEPTED == responseCode) {
                 in = getPartialResponse();
-                if ((in == null) || !doProcessResponse(outMessage)) {
+                if (in == null 
+                    || !MessageUtils.getContextualBoolean(outMessage, Message.PROCESS_ONEWAY_RESPONSE,
false)) {
                     // oneway operation or decoupled MEP without 
                     // partial response
                     closeInputStream();
@@ -1580,12 +1584,9 @@ public abstract class HTTPConduit
                             cc.handleResponse(null, null);
                         }
                     }
-                    if (in != null) {
-                        in.close();
-                    }
                     exchange.setInMessage(inMessage);
                     return;
-                }
+                } 
             } else {
                 //not going to be resending or anything, clear out the stuff in the out message
                 //to free memory

http://git-wip-us.apache.org/repos/asf/cxf/blob/ad1edc90/systests/uncategorized/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java
----------------------------------------------------------------------
diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java
b/systests/uncategorized/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java
index 8596763..d4da313 100644
--- a/systests/uncategorized/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java
+++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/interceptor/InterceptorFaultTest.java
@@ -30,6 +30,7 @@ import java.util.logging.Logger;
 import javax.xml.namespace.QName;
 import javax.xml.ws.Endpoint;
 import javax.xml.ws.WebServiceException;
+import javax.xml.ws.soap.SOAPFaultException;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
@@ -56,6 +57,7 @@ import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
 import org.apache.cxf.transport.http.HTTPConduit;
 import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
 import org.apache.cxf.ws.addressing.MAPAggregator;
+
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -204,9 +206,8 @@ public class InterceptorFaultTest extends AbstractBusClientServerTestBase
{
             client.getEndpoint().put(Message.ROBUST_ONEWAY, true);
             greeter.greetMeOneWay("oneway");
             fail("Oneway operation unexpectedly succeded for phase " + location.getPhase());
-        } catch (WebServiceException ex) {
-            // actually it should be instance of javax.xml.ws.soap.SOAPFaultException
-            assertEquals(FAULT_MESSAGE, ex.getMessage());
+        } catch (SOAPFaultException ex) {
+            //expected
         }
     }
 


Mime
View raw message