cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r652503 - in /cxf/trunk: api/src/main/java/org/apache/cxf/databinding/ api/src/main/java/org/apache/cxf/message/ api/src/main/java/org/apache/cxf/service/model/ api/src/main/java/org/apache/cxf/wsdl/ common/common/src/main/java/org/apache/c...
Date Thu, 01 May 2008 12:56:20 GMT
Author: dkulp
Date: Thu May  1 05:56:20 2008
New Revision: 652503

URL: http://svn.apache.org/viewvc?rev=652503&view=rev
Log:
[CXF-1560, CXF-1559, CXF-1558, CXF-1546]
* Fix some syncronization issues around the schema access
* Fix cdata outputting in StaxUtils
* Add support for querying the Attachments from client side with JAX-WS
* Fix support for Sets when ASM is found


Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java
    cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java
    cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java
    cxf/trunk/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java
    cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
    cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperHelperCompiler.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
    cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java
    cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java?rev=652503&r1=652502&r2=652503&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java Thu May
 1 05:56:20 2008
@@ -89,8 +89,11 @@
         }
         SchemaInfo schema = new SchemaInfo(serviceInfo, ns);
         schema.setSystemId(systemId);
-        XmlSchema xmlSchema = col.read(d, systemId, null);
-        schema.setSchema(xmlSchema);
+        XmlSchema xmlSchema;
+        synchronized (d) {
+            xmlSchema = col.read(d, systemId, null);
+            schema.setSchema(xmlSchema);
+        }
         serviceInfo.addSchema(schema);
         return xmlSchema;
     }

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java?rev=652503&r1=652502&r2=652503&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java Thu May  1 05:56:20 2008
@@ -57,6 +57,7 @@
     String ENCODING = Message.class.getName() + ".ENCODING";
     String FIXED_PARAMETER_ORDER = Message.class.getName() + "FIXED_PARAMETER_ORDER";
     String MAINTAIN_SESSION = Message.class.getName() + ".MAINTAIN_SESSION";
+    String ATTACHMENTS = Message.class.getName() + ".ATTACHMENTS";
 
     String WSDL_DESCRIPTION = "javax.xml.ws.wsdl.description";
     String WSDL_SERVICE = "javax.xml.ws.wsdl.service";

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java?rev=652503&r1=652502&r2=652503&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java Thu May  1 05:56:20
2008
@@ -49,6 +49,7 @@
 
     public void setAttachments(Collection<Attachment> attachments) {
         this.attachments = attachments;
+        put(ATTACHMENTS, attachments);
     }
 
     public String getAttachmentMimeType() {

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java?rev=652503&r1=652502&r2=652503&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java Thu May  1 05:56:20
2008
@@ -76,10 +76,13 @@
         this.namespaceUri = nsUri;
     }
 
-    public Element getElement() {
+    public synchronized Element getElement() {
         if (element == null && getSchema() != null) {
             CachedOutputStream cout = new CachedOutputStream();
-            getSchema().write(cout);
+            XmlSchema sch = getSchema();
+            synchronized (sch) {
+                getSchema().write(cout);
+            }
             Document sdoc = null;
             try {
                 sdoc = XMLUtils.parse(cout.getInputStream());

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java?rev=652503&r1=652502&r2=652503&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java Thu May  1
05:56:20 2008
@@ -564,14 +564,11 @@
         return null;
     }
     
-    public static Schema getSchema(ServiceInfo serviceInfo) {
-        if (serviceInfo == null) {
-            return null;
-        }
+    
+    private static Schema createSchema(ServiceInfo serviceInfo) {
         Schema schema = serviceInfo.getProperty(Schema.class.getName(), Schema.class);
-        if (schema == null && !serviceInfo.hasProperty(Schema.class.getName())) {
-            SchemaFactory factory = SchemaFactory.newInstance(
-                XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        if (schema == null) {
+            SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
             List<Source> schemaSources = new ArrayList<Source>();
             for (SchemaInfo schemaInfo : serviceInfo.getSchemas()) {
                 Source source = new DOMSource(schemaInfo.getElement());
@@ -594,7 +591,20 @@
                     LOG.log(Level.WARNING, "Schema for: " + schemaInfo.getNamespaceURI()
+ "\n" + s);
                 }
             }
-            serviceInfo.setProperty(Schema.class.getName(), schema);            
+            serviceInfo.setProperty(Schema.class.getName(), schema);
+        }
+        return schema;
+    }
+    
+    public static Schema getSchema(ServiceInfo serviceInfo) {
+        if (serviceInfo == null) {
+            return null;
+        }
+        Schema schema = serviceInfo.getProperty(Schema.class.getName(), Schema.class);
+        if (schema == null && !serviceInfo.hasProperty(Schema.class.getName())) {
+            synchronized (serviceInfo) {
+                return createSchema(serviceInfo);
+            }
         }
         return schema;
     }

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?rev=652503&r1=652502&r2=652503&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java Thu May
 1 05:56:20 2008
@@ -50,7 +50,6 @@
 import org.w3c.dom.EntityReference;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 import org.w3c.dom.ProcessingInstruction;
 import org.w3c.dom.Text;
 
@@ -530,11 +529,11 @@
             }
         }
 
-        NodeList nodes = e.getChildNodes();
-        for (int i = 0; i < nodes.getLength(); i++) {
-            Node n = nodes.item(i);
-            writeNode(n, writer, repairing);
-        }
+        Node nd = e.getFirstChild();
+        while (nd != null) {
+            writeNode(nd, writer, repairing);
+            nd = nd.getNextSibling();
+        }       
 
         if (endElement) {
             writer.writeEndElement();
@@ -545,10 +544,10 @@
         throws XMLStreamException {
         if (n instanceof Element) {
             writeElement((Element)n, writer, repairing);
-        } else if (n instanceof Text) {
-            writer.writeCharacters(((Text)n).getNodeValue());
         } else if (n instanceof CDATASection) {
             writer.writeCData(((CDATASection)n).getData());
+        } else if (n instanceof Text) {
+            writer.writeCharacters(((Text)n).getNodeValue());
         } else if (n instanceof Comment) {
             writer.writeComment(((Comment)n).getData());
         } else if (n instanceof EntityReference) {

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java?rev=652503&r1=652502&r2=652503&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/SchemaUtil.java Thu May  1 05:56:20
2008
@@ -93,27 +93,29 @@
                     }
                 }
                 if (schemaElem != null) {
-                    for (Object prefix : def.getNamespaces().keySet()) {
-                        String ns = (String)def.getNamespaces().get(prefix);
-                        if (!"".equals(prefix) && !schemaElem.hasAttribute("xmlns:"
+ prefix)) {
-                            schemaElem.setAttributeNS(javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI,
-                                                      "xmlns:" + prefix, ns);
+                    synchronized (schemaElem.getOwnerDocument()) {
+                        for (Object prefix : def.getNamespaces().keySet()) {
+                            String ns = (String)def.getNamespaces().get(prefix);
+                            if (!"".equals(prefix) && !schemaElem.hasAttribute("xmlns:"
+ prefix)) {
+                                schemaElem.setAttributeNS(javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI,
+                                                          "xmlns:" + prefix, ns);
+                            }
                         }
+                        String systemId = def.getDocumentBaseURI() + "#types" + schemaCount;
+    
+                        schemaCol.setBaseUri(def.getDocumentBaseURI());
+                        CatalogXmlSchemaURIResolver schemaResolver =
+                            new CatalogXmlSchemaURIResolver(OASISCatalogManager.getCatalogManager(bus));
+                        schemaCol.setSchemaResolver(schemaResolver);
+                        
+                        XmlSchema xmlSchema = schemaCol.read(schemaElem, systemId);
+                        SchemaInfo schemaInfo = new SchemaInfo(serviceInfo, xmlSchema.getTargetNamespace());
+                        schemaInfo.setElement(schemaElem);
+                        schemaInfo.setSchema(xmlSchema);
+                        schemaInfo.setSystemId(systemId);
+                        serviceInfo.addSchema(schemaInfo);
+                        schemaCount++;
                     }
-                    String systemId = def.getDocumentBaseURI() + "#types" + schemaCount;
-
-                    schemaCol.setBaseUri(def.getDocumentBaseURI());
-                    CatalogXmlSchemaURIResolver schemaResolver =
-                        new CatalogXmlSchemaURIResolver(OASISCatalogManager.getCatalogManager(bus));
-                    schemaCol.setSchemaResolver(schemaResolver);
-                    
-                    XmlSchema xmlSchema = schemaCol.read(schemaElem, systemId);
-                    SchemaInfo schemaInfo = new SchemaInfo(serviceInfo, xmlSchema.getTargetNamespace());
-                    schemaInfo.setElement(schemaElem);
-                    schemaInfo.setSchema(xmlSchema);
-                    schemaInfo.setSystemId(systemId);
-                    serviceInfo.addSchema(schemaInfo);
-                    schemaCount++;
                 }
             }
         }

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperHelperCompiler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperHelperCompiler.java?rev=652503&r1=652502&r2=652503&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperHelperCompiler.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperHelperCompiler.java
Thu May  1 05:56:20 2008
@@ -20,7 +20,7 @@
 
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
-import java.util.Collection;
+import java.util.List;
 
 import javax.xml.bind.JAXBElement;
 
@@ -248,7 +248,7 @@
             Class<?> tp = getMethods[x].getReturnType();
             mv.visitVarInsn(Opcodes.ALOAD, 2);            
             
-            if (Collection.class.isAssignableFrom(tp)) {
+            if (List.class.isAssignableFrom(tp)) {
                 doCollection(mv, x);
             } else { 
                 if (JAXBElement.class.isAssignableFrom(tp)) {

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java?rev=652503&r1=652502&r2=652503&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ContextPropertiesMapping.java
Thu May  1 05:56:20 2008
@@ -129,6 +129,15 @@
             context.put(MessageContext.HTTP_RESPONSE_HEADERS, responseHeaders);
         }  
         mapContext(context, cxf2jaxwsMap);
+        
+        Collection<Attachment> attachments 
+            = CastUtils.cast((Collection<?>)context.get(Message.ATTACHMENTS));
+        Map<String, DataHandler> dataHandlers = getDHMap(attachments);
+        context.put(MessageContext.INBOUND_MESSAGE_ATTACHMENTS, dataHandlers);
+        Map<String, Scope> scopes = CastUtils.cast((Map<?, ?>)context.get(WrappedMessageContext.SCOPES));
+        if (scopes != null) {
+            scopes.put(MessageContext.INBOUND_MESSAGE_ATTACHMENTS, Scope.APPLICATION);
+        }
     }
     
     private static void mapJaxws2Cxf(Map<String, Object> context) {
@@ -229,13 +238,9 @@
         }
 
     }
-    
-    private static void addMessageAttachments(WrappedMessageContext ctx,
-                                              Message message,
-                                              String propertyName) {
-        Map<String, DataHandler> dataHandlers = null;
 
-        Collection<Attachment> attachments = message.getAttachments();
+    private static Map<String, DataHandler> getDHMap(Collection<Attachment> attachments)
{
+        Map<String, DataHandler> dataHandlers = null;
         if (attachments != null) {
             if (attachments instanceof LazyAttachmentCollection) {
                 dataHandlers = ((LazyAttachmentCollection)attachments).createDataHandlerMap();
@@ -247,7 +252,14 @@
                 }
             }
         }
+        return dataHandlers;
+    }
+    private static void addMessageAttachments(WrappedMessageContext ctx,
+                                              Message message,
+                                              String propertyName) {
 
+        Collection<Attachment> attachments = message.getAttachments();
+        Map<String, DataHandler> dataHandlers = getDHMap(attachments);
         ctx.put(propertyName, 
                 dataHandlers == null ? new LinkedHashMap<String, DataHandler>()
                                      : dataHandlers,

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java?rev=652503&r1=652502&r2=652503&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
Thu May  1 05:56:20 2008
@@ -25,6 +25,7 @@
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
+import java.util.Set;
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.Holder;
@@ -263,6 +264,9 @@
         assertEquals("Hello", echoMsg);
     }
     private void runDocLitTest(DocLitWrappedCodeFirstService port) throws Exception {
+        Set<Foo> fooSet = port.getFooSet();
+        assertEquals(2, fooSet.size());
+        
         assertEquals(24, port.echoIntDifferentWrapperName(24));
         
         String echoMsg = port.echo("Hello");

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java?rev=652503&r1=652502&r2=652503&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstService.java
Thu May  1 05:56:20 2008
@@ -19,6 +19,7 @@
 package org.apache.cxf.systest.jaxws;
 
 import java.util.List;
+import java.util.Set;
 import java.util.Vector;
 
 import javax.jws.WebMethod;
@@ -124,5 +125,6 @@
         }
     }
     
+    Set<Foo> getFooSet();
 
 }

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java?rev=652503&r1=652502&r2=652503&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
(original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitWrappedCodeFirstServiceImpl.java
Thu May  1 05:56:20 2008
@@ -19,7 +19,9 @@
 package org.apache.cxf.systest.jaxws;
 
 import java.util.Arrays;
+import java.util.LinkedHashSet;
 import java.util.List;
+import java.util.Set;
 import java.util.Vector;
 
 import javax.annotation.Resource;
@@ -29,6 +31,7 @@
 
 import org.apache.cxf.feature.Features;
 import org.apache.cxf.message.Exchange;
+import org.apache.cxf.systest.jaxws.DocLitWrappedCodeFirstService.Foo;
 import org.apache.cxf.systest.jaxws.types.Bar;
 import org.apache.cxf.systest.jaxws.types.BarImpl;
 
@@ -133,6 +136,10 @@
         b.setName("b");
         return Arrays.asList(a, b);
     }
+    
+    public Set<Foo> getFooSet() {
+        return new LinkedHashSet<Foo>(listObjectOutput());
+    }
 
     public List<Foo[]> listObjectArrayOutput() {
         Foo a = new Foo();

Modified: cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java?rev=652503&r1=652502&r2=652503&view=diff
==============================================================================
--- cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java
(original)
+++ cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java
Thu May  1 05:56:20 2008
@@ -84,43 +84,44 @@
         if (document == null) {
             return schemaList;
         }
-        // URL might need encoding for special characters.
-        baseURI = URLEncoder.encode(baseURI, "utf-8");
-        SchemaCollection schemaCol = new SchemaCollection();
-        schemaCol.setBaseUri(baseURI);
-        NodeList nodes = document.getElementsByTagNameNS(
-            WSDLConstants.NS_SCHEMA_XSD, "schema");
-        for (int x = 0; x < nodes.getLength(); x++) {
-            Node schemaNode = nodes.item(x);
-            Element schemaEl = (Element) schemaNode;
-            String tns = schemaEl.getAttribute("targetNamespace");
-            try {
-                schemaCol.read(schemaEl, tns);
-            } catch (RuntimeException ex) {
-                LOG.log(Level.WARNING, "SCHEMA_READ_FAIL", tns);
-                //
-                // Couldn't find schema... check if it's relative to wsdl.
-                // XXX - Using setBaseUri() on the XmlSchemaCollection,
-                // only seems to work for the first imported xsd... so pass
-                // in the baseURI here.
-                //
+        synchronized (document) {
+            // URL might need encoding for special characters.
+            baseURI = URLEncoder.encode(baseURI, "utf-8");
+            SchemaCollection schemaCol = new SchemaCollection();
+            schemaCol.setBaseUri(baseURI);
+            NodeList nodes = document.getElementsByTagNameNS(
+                WSDLConstants.NS_SCHEMA_XSD, "schema");
+            for (int x = 0; x < nodes.getLength(); x++) {
+                Node schemaNode = nodes.item(x);
+                Element schemaEl = (Element) schemaNode;
+                String tns = schemaEl.getAttribute("targetNamespace");
                 try {
-                    schemaCol.read(schemaEl, baseURI);
-                } catch (RuntimeException ex2) {
-                    LOG.log(Level.WARNING, "SCHEMA_READ_FAIL", baseURI);
-                    continue;
+                    schemaCol.read(schemaEl, tns);
+                } catch (RuntimeException ex) {
+                    LOG.log(Level.WARNING, "SCHEMA_READ_FAIL", tns);
+                    //
+                    // Couldn't find schema... check if it's relative to wsdl.
+                    // XXX - Using setBaseUri() on the XmlSchemaCollection,
+                    // only seems to work for the first imported xsd... so pass
+                    // in the baseURI here.
+                    //
+                    try {
+                        schemaCol.read(schemaEl, baseURI);
+                    } catch (RuntimeException ex2) {
+                        LOG.log(Level.WARNING, "SCHEMA_READ_FAIL", baseURI);
+                        continue;
+                    }
                 }
             }
-        }
-        schemaList.add(schemaCol);
-        
-        // Now add schemas from imported wsdl files.
-        Map<String, Document> wsdlImports = getImportedWsdlMap(
-            document, baseURI);
-        for (Document wsdlImport : wsdlImports.values()) {
-            schemaList.addAll(getSchemaList(wsdlImport, baseURI));
-        }
-        
+            schemaList.add(schemaCol);
+            
+            // Now add schemas from imported wsdl files.
+            Map<String, Document> wsdlImports = getImportedWsdlMap(
+                document, baseURI);
+            for (Document wsdlImport : wsdlImports.values()) {
+                schemaList.addAll(getSchemaList(wsdlImport, baseURI));
+            }
+        }        
         return schemaList;
     }
     

Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java?rev=652503&r1=652502&r2=652503&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java
(original)
+++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ProcessorUtil.java
Thu May  1 05:56:20 2008
@@ -364,7 +364,9 @@
             Map<String, Element> maps = CastUtils.cast((Map<?, ?>)context.get(ToolConstants.SCHEMA_MAP));
             if (maps != null) {
                 for (Element ele : maps.values()) {
-                    schema.read(ele);
+                    synchronized (ele.getOwnerDocument()) {
+                        schema.read(ele);
+                    }
                 }
                 elementByName = schema.getElementByQName(partElement);
             }



Mime
View raw message