You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2008/05/30 16:33:03 UTC

svn commit: r661735 - in /cxf/trunk: rt/core/src/main/java/org/apache/cxf/transport/http/ systests/src/test/java/org/apache/cxf/systest/jaxws/ testutils/src/main/java/org/apache/hello_world/ testutils/src/main/resources/wsdl/ testutils/src/main/resourc...

Author: dkulp
Date: Fri May 30 07:33:02 2008
New Revision: 661735

URL: http://svn.apache.org/viewvc?rev=661735&view=rev
Log:
Try to prevent some infinite loops when using recursively imported schemas

Added:
    cxf/trunk/testutils/src/main/resources/wsdl/others/hello_world_schema.xsd
      - copied, changed from r661554, cxf/trunk/testutils/src/main/resources/wsdl/hello_world_schema.xsd
    cxf/trunk/testutils/src/main/resources/wsdl/others/hello_world_schema2.xsd
      - copied, changed from r661554, cxf/trunk/testutils/src/main/resources/wsdl/hello_world_schema2.xsd
Removed:
    cxf/trunk/testutils/src/main/resources/wsdl/hello_world_schema.xsd
    cxf/trunk/testutils/src/main/resources/wsdl/hello_world_schema2.xsd
Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/OASISCatalogTest.java
    cxf/trunk/testutils/src/main/java/org/apache/hello_world/GreeterImpl.java
    cxf/trunk/testutils/src/main/resources/wsdl/others/hello_world_messages_catalog.wsdl

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java?rev=661735&r1=661734&r2=661735&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java Fri May 30 07:33:02 2008
@@ -265,13 +265,15 @@
                         //check to see if it's already in a URL format.  If so, leave it.
                         new URL(start);
                     } catch (MalformedURLException e) {
-                        done.put(start, imp.getDefinition());
-                        updateDefinition(imp.getDefinition(), done, doneSchemas, base, ei);
+                        if (done.put(start, imp.getDefinition()) == null) {
+                            updateDefinition(imp.getDefinition(), done, doneSchemas, base, ei);
+                        }
                     }
                 } else {
-                    done.put(start, imp.getDefinition());
-                    done.put(resolvedSchemaLocation, imp.getDefinition());
-                    updateDefinition(imp.getDefinition(), done, doneSchemas, base, ei);
+                    if (done.put(start, imp.getDefinition()) == null) {
+                        done.put(resolvedSchemaLocation, imp.getDefinition());
+                        updateDefinition(imp.getDefinition(), done, doneSchemas, base, ei);
+                    }
                 }
             }
         }      
@@ -340,13 +342,15 @@
                             //check to see if it's already in a URL format.  If so, leave it.
                             new URL(start);
                         } catch (MalformedURLException e) {
-                            doneSchemas.put(start, imp);
-                            updateSchemaImports(imp.getReferencedSchema(), doneSchemas, base);
+                            if (doneSchemas.put(start, imp) == null) {
+                                updateSchemaImports(imp.getReferencedSchema(), doneSchemas, base);
+                            }
                         }
                     } else {
-                        doneSchemas.put(start, imp);
-                        doneSchemas.put(resolvedSchemaLocation, imp);
-                        updateSchemaImports(imp.getReferencedSchema(), doneSchemas, base);
+                        if (doneSchemas.put(start, imp) == null) {
+                            doneSchemas.put(resolvedSchemaLocation, imp);
+                            updateSchemaImports(imp.getReferencedSchema(), doneSchemas, base);
+                        }
                     }
                 }
             }
@@ -363,8 +367,9 @@
                             //check to see if it's aleady in a URL format.  If so, leave it.
                             new URL(start);
                         } catch (MalformedURLException e) {
-                            doneSchemas.put(start, included);
-                            updateSchemaImports(included.getReferencedSchema(), doneSchemas, base);
+                            if (doneSchemas.put(start, included) == null) {
+                                updateSchemaImports(included.getReferencedSchema(), doneSchemas, base);
+                            }
                         }
                     }
                 } else if (!doneSchemas.containsKey(start) 

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/OASISCatalogTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/OASISCatalogTest.java?rev=661735&r1=661734&r2=661735&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/OASISCatalogTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/OASISCatalogTest.java Fri May 30 07:33:02 2008
@@ -59,19 +59,21 @@
         Endpoint ep = Endpoint.publish(null, new GreeterImpl());
         try {
             URL url = new URL("http://localhost:9000/SoapContext/SoapPort?"
-                              + "xsd=testutils/hello_world_schema2.xsd");
+                              + "xsd=hello_world_schema2.xsd");
             assertNotNull(url.getContent());
+            String result = IOUtils.toString((InputStream)url.getContent());
+            assertTrue(result, result.contains("xsd=hello_world_schema.xsd"));
             
             
             url = new URL("http://localhost:9000/SoapContext/SoapPort"
-                          + "?xsd=testutils/hello_world_schema.xsd");
-            String result = IOUtils.toString((InputStream)url.getContent());
-            assertTrue(result.contains("xsd=testutils/hello_world_schema2.xsd"));
+                          + "?xsd=hello_world_schema.xsd");
+            result = IOUtils.toString((InputStream)url.getContent());
+            assertTrue(result, result.contains("xsd=hello_world_schema2.xsd"));
 
             url = new URL("http://localhost:9000/SoapContext/SoapPort"
                           + "?wsdl=testutils/others/hello_world_messages_catalog.wsdl");
             result = IOUtils.toString((InputStream)url.getContent());
-            assertTrue(result.contains("xsd=testutils/hello_world_schema.xsd"));
+            assertTrue(result, result.contains("xsd=hello_world_schema.xsd"));
 
         } finally {
             ep.stop();

Modified: cxf/trunk/testutils/src/main/java/org/apache/hello_world/GreeterImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/testutils/src/main/java/org/apache/hello_world/GreeterImpl.java?rev=661735&r1=661734&r2=661735&view=diff
==============================================================================
--- cxf/trunk/testutils/src/main/java/org/apache/hello_world/GreeterImpl.java (original)
+++ cxf/trunk/testutils/src/main/java/org/apache/hello_world/GreeterImpl.java Fri May 30 07:33:02 2008
@@ -30,6 +30,9 @@
             wsdlLocation = "testutils/others/hello_world_services_catalog.wsdl")
 public class GreeterImpl implements Greeter {
 
+    public GreeterImpl() {
+    }
+    
     public String greetMe(String requestType) {
         return "Hello " + requestType;
     }

Modified: cxf/trunk/testutils/src/main/resources/wsdl/others/hello_world_messages_catalog.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/testutils/src/main/resources/wsdl/others/hello_world_messages_catalog.wsdl?rev=661735&r1=661734&r2=661735&view=diff
==============================================================================
--- cxf/trunk/testutils/src/main/resources/wsdl/others/hello_world_messages_catalog.wsdl (original)
+++ cxf/trunk/testutils/src/main/resources/wsdl/others/hello_world_messages_catalog.wsdl Fri May 30 07:33:02 2008
@@ -29,7 +29,7 @@
         <schema targetNamespace="http://apache.org/hello_world/types/schema" 
             xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
             <xsd:import namespace="http://apache.org/hello_world/types" 
-                schemaLocation="testutils/hello_world_schema.xsd"/>
+                schemaLocation="hello_world_schema.xsd"/>
         </schema>
     </wsdl:types>
     <wsdl:message name="sayHiRequest">

Copied: cxf/trunk/testutils/src/main/resources/wsdl/others/hello_world_schema.xsd (from r661554, cxf/trunk/testutils/src/main/resources/wsdl/hello_world_schema.xsd)
URL: http://svn.apache.org/viewvc/cxf/trunk/testutils/src/main/resources/wsdl/others/hello_world_schema.xsd?p2=cxf/trunk/testutils/src/main/resources/wsdl/others/hello_world_schema.xsd&p1=cxf/trunk/testutils/src/main/resources/wsdl/hello_world_schema.xsd&r1=661554&r2=661735&rev=661735&view=diff
==============================================================================
--- cxf/trunk/testutils/src/main/resources/wsdl/hello_world_schema.xsd (original)
+++ cxf/trunk/testutils/src/main/resources/wsdl/others/hello_world_schema.xsd Fri May 30 07:33:02 2008
@@ -24,7 +24,7 @@
             elementFormDefault="qualified">
 
     <import namespace="http://apache.org/hello_world/types2" 
-        schemaLocation="testutils/hello_world_schema2.xsd"/>
+        schemaLocation="hello_world_schema2.xsd"/>
 
 
     <element name="sayHi">

Copied: cxf/trunk/testutils/src/main/resources/wsdl/others/hello_world_schema2.xsd (from r661554, cxf/trunk/testutils/src/main/resources/wsdl/hello_world_schema2.xsd)
URL: http://svn.apache.org/viewvc/cxf/trunk/testutils/src/main/resources/wsdl/others/hello_world_schema2.xsd?p2=cxf/trunk/testutils/src/main/resources/wsdl/others/hello_world_schema2.xsd&p1=cxf/trunk/testutils/src/main/resources/wsdl/hello_world_schema2.xsd&r1=661554&r2=661735&rev=661735&view=diff
==============================================================================
--- cxf/trunk/testutils/src/main/resources/wsdl/hello_world_schema2.xsd (original)
+++ cxf/trunk/testutils/src/main/resources/wsdl/others/hello_world_schema2.xsd Fri May 30 07:33:02 2008
@@ -20,7 +20,11 @@
 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
     targetNamespace="http://apache.org/hello_world/types2"
             elementFormDefault="qualified">
-    <element name="sayHi2">
-        <complexType/>
-    </element>
+
+    <xsd:import namespace="http://apache.org/hello_world/types"
+        schemaLocation="hello_world_schema.xsd"/>
+
+    <xsd:element name="sayHi2">
+        <xsd:complexType/>
+    </xsd:element>
 </xsd:schema>