cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1440922 - in /cxf/trunk: api/src/main/java/org/apache/cxf/service/model/ services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/ services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/disc...
Date Thu, 31 Jan 2013 12:07:19 GMT
Author: sergeyb
Date: Thu Jan 31 12:07:18 2013
New Revision: 1440922

URL: http://svn.apache.org/viewvc?rev=1440922&view=rev
Log:
[CXF-4767] Fixing one more NPE when JAX-RS endpoints register with WS-Discovery service

Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceModelUtil.java
    cxf/trunk/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java
    cxf/trunk/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/listeners/WSDiscoveryServerListener.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceModelUtil.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceModelUtil.java?rev=1440922&r1=1440921&r2=1440922&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceModelUtil.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/service/model/ServiceModelUtil.java Thu Jan
31 12:07:18 2013
@@ -183,4 +183,16 @@ public final class ServiceModelUtil {
 
         return best;
     }
+    
+    public static QName getServiceQName(EndpointInfo ei) {
+        InterfaceInfo ii = ei.getInterface();
+        if (ii != null) {
+            return ii.getName();
+        } else if (ei.getService() != null) {
+            return ei.getService().getName();
+        } else {
+            return ei.getName();
+        }
+        
+    }
 }

Modified: cxf/trunk/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java?rev=1440922&r1=1440921&r2=1440922&view=diff
==============================================================================
--- cxf/trunk/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java
(original)
+++ cxf/trunk/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/internal/WSDiscoveryServiceImpl.java
Thu Jan 31 12:07:18 2013
@@ -55,6 +55,7 @@ import org.apache.cxf.BusFactory;
 import org.apache.cxf.common.jaxb.JAXBContextCache;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.service.model.ServiceModelUtil;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.staxutils.transform.InTransformReader;
 import org.apache.cxf.ws.discovery.WSDiscoveryClient;
@@ -123,7 +124,10 @@ public class WSDiscoveryServiceImpl impl
         HelloType ht = new HelloType();
         ht.setScopes(new ScopesType());
         ht.setMetadataVersion(1);
-        ht.getTypes().add(server.getEndpoint().getEndpointInfo().getInterface().getName());
+        
+        QName sn = ServiceModelUtil.getServiceQName(server.getEndpoint().getEndpointInfo());
+        ht.getTypes().add(sn);
+        
         Object o = server.getEndpoint().get("ws-discovery-scopes");
         if (o != null) {
             setScopes(ht, o);

Modified: cxf/trunk/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/listeners/WSDiscoveryServerListener.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/listeners/WSDiscoveryServerListener.java?rev=1440922&r1=1440921&r2=1440922&view=diff
==============================================================================
--- cxf/trunk/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/listeners/WSDiscoveryServerListener.java
(original)
+++ cxf/trunk/services/ws-discovery/ws-discovery-api/src/main/java/org/apache/cxf/ws/discovery/listeners/WSDiscoveryServerListener.java
Thu Jan 31 12:07:18 2013
@@ -25,14 +25,16 @@ import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.endpoint.ServerLifeCycleListener;
-import org.apache.cxf.service.model.EndpointInfo;
-import org.apache.cxf.service.model.InterfaceInfo;
+import org.apache.cxf.service.model.ServiceModelUtil;
 import org.apache.cxf.ws.discovery.internal.WSDiscoveryServiceImpl;
 
 /**
  * 
  */
 public class WSDiscoveryServerListener implements ServerLifeCycleListener {
+    private static final String WS_DISCOVERY_SERVICE_NS = 
+        "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01";
+    
     final Bus bus;
     volatile WSDiscoveryServiceImpl service;
 
@@ -65,31 +67,22 @@ public class WSDiscoveryServerListener i
     }
 
     public void startServer(Server server) {
-        QName sn = getServiceQName(server);
-        if ("http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01".equals(sn.getNamespaceURI()))
{
+        if (isWsDiscoveryServer(server)) {
             return;
         }
         getService().serverStarted(server);
     }
 
     public void stopServer(Server server) {
-        QName sn = getServiceQName(server);
-        if ("http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01".equals(sn.getNamespaceURI()))
{
+        if (isWsDiscoveryServer(server)) {
             return;
         }
         getService().serverStopped(server);
     }
     
-    private QName getServiceQName(Server server) {
-        EndpointInfo ei = server.getEndpoint().getEndpointInfo();
-        InterfaceInfo ii = ei.getInterface();
-        if (ii != null) {
-            return ii.getName();
-        } else if (ei.getService() != null) {
-            return ei.getService().getName();
-        } else {
-            return ei.getName();
-        }
+    private boolean isWsDiscoveryServer(Server server) {
+        QName sn = ServiceModelUtil.getServiceQName(server.getEndpoint().getEndpointInfo());
+        return WS_DISCOVERY_SERVICE_NS.equals(sn.getNamespaceURI());
     }
     
 }



Mime
View raw message