cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r657978 - in /cxf/trunk: rt/core/src/main/java/org/apache/cxf/transport/ rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/ systests/src/test/java/org/apache/cxf/systest/http/
Date Mon, 19 May 2008 21:07:55 GMT
Author: dkulp
Date: Mon May 19 14:07:54 2008
New Revision: 657978

URL: http://svn.apache.org/viewvc?rev=657978&view=rev
Log:
[CXF-1589] Fix problems of calling Endpoint.publish with a busy port not always throwing an
exception back

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractObservable.java
    cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
    cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPTransportFactory.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/ClientServerSessionTest.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractObservable.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractObservable.java?rev=657978&r1=657977&r2=657978&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractObservable.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractObservable.java Mon May
19 14:07:54 2008
@@ -44,7 +44,12 @@
             if (observer != null) {
                 getLogger().fine("registering incoming observer: " + observer);
                 if (old == null) {
-                    activate();
+                    try {
+                        activate();
+                    } catch (RuntimeException ex) {
+                        incomingObserver = null;
+                        throw ex;
+                    }
                 }
             } else {
                 if (old != null) {

Modified: cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java?rev=657978&r1=657977&r2=657978&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
(original)
+++ cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
Mon May 19 14:07:54 2008
@@ -309,6 +309,7 @@
                 } catch (Exception ex) {
                     //ignore - probably wasn't fully started anyway
                 }
+                server = null;
                 throw new Fault(new Message("START_UP_SERVER_FAILED_MSG", LOG, e.getMessage()),
e);
             }
         }        

Modified: cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPTransportFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPTransportFactory.java?rev=657978&r1=657977&r2=657978&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPTransportFactory.java
(original)
+++ cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPTransportFactory.java
Mon May 19 14:07:54 2008
@@ -21,8 +21,8 @@
 import java.io.IOException;
 import java.security.GeneralSecurityException;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
@@ -39,7 +39,7 @@
     implements DestinationFactory {
 
     private Map<String, JettyHTTPDestination> destinations = 
-        new HashMap<String, JettyHTTPDestination>();
+        new ConcurrentHashMap<String, JettyHTTPDestination>();
     
     public JettyHTTPTransportFactory() {
         super();
@@ -98,7 +98,7 @@
         throws IOException {
         
         String addr = endpointInfo.getAddress();
-        JettyHTTPDestination destination = destinations.get(addr);
+        JettyHTTPDestination destination = addr == null ? null : destinations.get(addr);
         if (destination == null) {
             destination = createDestination(endpointInfo);
         }
@@ -110,8 +110,8 @@
         EndpointInfo endpointInfo
     ) throws IOException {
         
-        JettyHTTPDestination destination = 
-            destinations.get(endpointInfo.getAddress());
+        String addr = endpointInfo.getAddress();
+        JettyHTTPDestination destination = addr == null ? null : destinations.get(addr);
         if (destination == null) {
             destination = 
                 new JettyHTTPDestination(getBus(), this, endpointInfo);

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/ClientServerSessionTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/ClientServerSessionTest.java?rev=657978&r1=657977&r2=657978&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/ClientServerSessionTest.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/http/ClientServerSessionTest.java
Mon May 19 14:07:54 2008
@@ -22,6 +22,8 @@
 import java.lang.reflect.UndeclaredThrowableException;
 
 import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.WebServiceException;
 
 import org.apache.cxf.greeter_control.Greeter;
 import org.apache.cxf.greeter_control.GreeterService;
@@ -94,4 +96,24 @@
         }
     }
     
+    @Test
+    public void testPublishOnBusyPort() {
+        GreeterSessionImpl implementor = new GreeterSessionImpl();
+        String address = "http://localhost:9020/SoapContext/GreeterPort";
+        try {
+            Endpoint.publish(address, implementor);
+            fail("Should have failed to publish as the port is busy");
+        } catch (WebServiceException ex) {
+            //ignore
+        }
+        try {
+            //CXF-1589
+            Endpoint.publish(address, implementor);
+            fail("Should have failed to publish as the port is busy");
+        } catch (WebServiceException ex) {
+            //ignore
+        }
+        
+    }
+    
 }



Mime
View raw message