Author: dkulp
Date: Mon Apr 14 11:22:03 2008
New Revision: 647922

URL: http://svn.apache.org/viewvc?rev=647922&view=rev
Log:
Sync on the Definition when writing out the wsdl since updating the wsdl and 
writing it out is not a thread safe operation.

Modified:
    
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java

Modified: 
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
URL: 
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java?rev=647922&r1=647921&r2=647922&view=diff
==============================================================================
--- 
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
 (original)
+++ 
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
 Mon Apr 14 11:22:03 2008
@@ -148,15 +148,20 @@
                     def = mp.get(wsdl2);
                 }
                 
-                if (endpointInfo.getProperty("publishedEndpointUrl") != null) {
-                    String publishingUrl = 
String.valueOf(endpointInfo.getProperty("publishedEndpointUrl"));
-                    updatePublishedEndpointUrl(publishingUrl, def, 
endpointInfo.getName());
+                synchronized (def) {
+                    //writing a def is not threadsafe.  Sync on it to make sure
+                    //we don't get any ConcurrentModificationExceptions
+                    if (endpointInfo.getProperty("publishedEndpointUrl") != 
null) {
+                        String publishingUrl = 
+                            
String.valueOf(endpointInfo.getProperty("publishedEndpointUrl"));
+                        updatePublishedEndpointUrl(publishingUrl, def, 
endpointInfo.getName());
+                    }
+        
+                    WSDLWriter wsdlWriter = bus.getExtension(WSDLManager.class)
+                        .getWSDLFactory().newWSDLWriter();
+                    
def.setExtensionRegistry(bus.getExtension(WSDLManager.class).getExtensionRegistry());
+                    doc = wsdlWriter.getDocument(def);
                 }
-    
-                WSDLWriter wsdlWriter = bus.getExtension(WSDLManager.class)
-                    .getWSDLFactory().newWSDLWriter();
-                
def.setExtensionRegistry(bus.getExtension(WSDLManager.class).getExtensionRegistry());
-                doc = wsdlWriter.getDocument(def);
             } else {
                 SchemaReference si = smp.get(xsd);
                 if (si == null) {


Reply via email to