cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asold...@apache.org
Subject [1/3] cxf git commit: [CXF-6655] Do not early fail when the HTTPConduit is initialized before a target address is set in the client (and there's no reference to a wsdl contract), perhaps because the user is setting up a proxy in the conduit; try using th
Date Fri, 30 Oct 2015 13:18:08 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 8dc621b15 -> f1a015924


[CXF-6655] Do not early fail when the HTTPConduit is initialized before a target address is
set in the client (and there's no reference to a wsdl contract), perhaps because the user
is setting up a proxy in the conduit; try using the endpoint address set in the request context
just before performing the invocation (and fail if that's not available either).


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

Branch: refs/heads/master
Commit: f1a015924d53e5e253aad55a49ef9a1853b6c26f
Parents: 01860c7
Author: Alessio Soldano <asoldano@redhat.com>
Authored: Fri Oct 30 14:09:32 2015 +0100
Committer: Alessio Soldano <asoldano@redhat.com>
Committed: Fri Oct 30 14:17:37 2015 +0100

----------------------------------------------------------------------
 .../apache/cxf/transport/http/HTTPConduit.java  | 38 ++++++++++++++------
 1 file changed, 28 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/f1a01592/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 f120abb..bb21424 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
@@ -676,10 +676,14 @@ public abstract class HTTPConduit
         setAndGetDefaultAddress();
         if (result == null) {
             if (pathInfo == null && queryString == null) {
-                message.put(Message.ENDPOINT_ADDRESS, defaultAddress.getString());
+                if (defaultAddress != null) {
+                    message.put(Message.ENDPOINT_ADDRESS, defaultAddress.getString());
+                }
                 return defaultAddress;
             }
-            message.put(Message.ENDPOINT_ADDRESS, defaultAddress.getString());
+            if (defaultAddress != null) {
+                message.put(Message.ENDPOINT_ADDRESS, defaultAddress.getString());
+            }
         }
         
         // REVISIT: is this really correct?
@@ -688,8 +692,12 @@ public abstract class HTTPConduit
         }
         if (queryString != null) {
             result = result + "?" + queryString;
-        }        
-        return result.equals(defaultAddress.getString()) ? defaultAddress : new Address(result);
+        }
+        if (defaultAddress == null) {
+            return setAndGetDefaultAddress(result);
+        } else {
+            return result.equals(defaultAddress.getString()) ? defaultAddress : new Address(result);
+        }
     }
 
     /**
@@ -726,12 +734,7 @@ public abstract class HTTPConduit
                 if (defaultAddress == null) {
                     if (fromEndpointReferenceType && getTarget().getAddress().getValue()
!= null) {
                         defaultAddress = new Address(this.getTarget().getAddress().getValue());
-                    } else {
-                        if (endpointInfo.getAddress() == null) {
-                            throw new URISyntaxException("<null>", 
-                                                         "Invalid address. Endpoint address
cannot be null.",
-                                                         0);
-                        }
+                    } else if (endpointInfo.getAddress() != null) {
                         defaultAddress = new Address(endpointInfo.getAddress());
                     }
                 }
@@ -740,6 +743,21 @@ public abstract class HTTPConduit
         return defaultAddress;
     }
 
+    private Address setAndGetDefaultAddress(String curAddr) throws URISyntaxException {
+        if (defaultAddress == null) {
+            synchronized (this) {
+                if (defaultAddress == null) {
+                    if (curAddr != null) {
+                        defaultAddress = new Address(curAddr);
+                    } else {
+                        throw new URISyntaxException("<null>",
+                                                     "Invalid address. Endpoint address cannot
be null.", 0);
+                    }
+                }
+            }
+        }
+        return defaultAddress;
+    }
     /**
      * This call places HTTP Header strings into the headers that are relevant
      * to the Authorization policies that are set on this conduit by


Mime
View raw message