cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sea...@apache.org
Subject svn commit: r688735 - in /cxf/trunk/tools: validator/src/main/java/org/apache/cxf/tools/validator/internal/ wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/ wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1694/
Date Mon, 25 Aug 2008 14:25:50 GMT
Author: seanoc
Date: Mon Aug 25 07:25:49 2008
New Revision: 688735

URL: http://svn.apache.org/viewvc?rev=688735&view=rev
Log:
Fix for https://issues.apache.org/jira/browse/CXF-1694
NPE with invalid wsld:impor

Added:
    cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1694/
    cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1694/child.wsdl
    cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1694/test.wsdl
Modified:
    cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
    cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java

Modified: cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java?rev=688735&r1=688734&r2=688735&view=diff
==============================================================================
--- cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
(original)
+++ cxf/trunk/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
Mon Aug 25 07:25:49 2008
@@ -247,7 +247,7 @@
                                                   vNode.getPlainText()));
                 }
             }
-        } catch (ToolException e) {
+        } catch (Exception e) {
             this.vResults.addError(e.getMessage());
             return false;
         }
@@ -393,7 +393,7 @@
     }
 
     @SuppressWarnings("unchecked")
-    private void collectValidationPoints() {
+    private void collectValidationPoints() throws Exception {
         if (services.size() == 0) {
             LOG.log(Level.WARNING, "WSDL document " 
                     + this.definition.getDocumentBaseURI() + " does not define any services");
@@ -407,7 +407,7 @@
         collectValidationPointsForMessages();
     }
 
-    private void collectValidationPointsForBindings() {
+    private void collectValidationPointsForBindings() throws Exception {
         Map<QName, XNode> vBindingNodes = new HashMap<QName, XNode>();
         for (Service service : services.values()) {
             vBindingNodes.putAll(getBindings(service));
@@ -415,6 +415,12 @@
 
         for (QName bName : vBindingNodes.keySet()) {
             Binding binding = this.definition.getBinding(bName);
+            if (binding == null) {
+                LOG.log(Level.SEVERE, bName.toString() 
+                        + " is not correct, please check that the correct namespace is being
used");
+                throw new Exception(bName.toString() 
+                        + " is not correct, please check that the correct namespace is being
used");
+            }
             XNode vBindingNode = getXNode(binding);
             vBindingNode.setFailurePoint(vBindingNodes.get(bName));
             vNodes.add(vBindingNode);

Modified: cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=688735&r1=688734&r2=688735&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
(original)
+++ cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Mon Aug 25 07:25:49 2008
@@ -1041,5 +1041,18 @@
         assertEquals("GreeterSOAPService", webServiceAnn.serviceName());
         assertEquals("PingSoapPort", webServiceAnn.portName());
     }
+
+    
+    @Test
+    public void testCXF1694() throws Exception {
+
+        try {
+            env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/cxf1694/test.wsdl"));
+            processor.setContext(env);
+            processor.execute();
+        } catch (Exception ex) {
+            assertTrue(ex.getMessage().contains("{http://child/}Binding is not correct"));
+        }
+    }
     
 }

Added: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1694/child.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1694/child.wsdl?rev=688735&view=auto
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1694/child.wsdl (added)
+++ cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1694/child.wsdl Mon Aug
25 07:25:49 2008
@@ -0,0 +1,39 @@
+<wsdl:definitions name="Child"
+  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:tns="http://child/"
+  xmlns:xsd="http://child/xsd"
+  targetNamespace="http://child/">
+  <wsdl:types>
+    <xs:schema targetNamespace="http://child/xsd">
+      <xs:element name="Message">
+        <xs:complexType>
+          <xs:sequence/>
+        </xs:complexType>
+      </xs:element>
+    </xs:schema>
+  </wsdl:types>
+  <wsdl:message name="Message">
+    <wsdl:part name="msg" element="xsd:Message"/>
+  </wsdl:message>
+  <wsdl:portType name="PortType">
+    <wsdl:operation name="Operation">
+      <wsdl:input message="tns:Message"/>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="Binding" type="tns:PortType">
+        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"
/>
+    <wsdl:operation name="Operation">
+      <soap:operation style="document"/>
+      <wsdl:input>
+        <soap:body use="literal"/>
+      </wsdl:input>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="Service">
+        <wsdl:port name="Port" binding="tns:Binding">
+            <soap:address location="http://localhost/service" />
+        </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file

Added: cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1694/test.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1694/test.wsdl?rev=688735&view=auto
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1694/test.wsdl (added)
+++ cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/cxf1694/test.wsdl Mon Aug
25 07:25:49 2008
@@ -0,0 +1,3 @@
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="Parent">
+    <wsdl:import namespace="http://incorrect-namespace" location="child.wsdl" />
+</wsdl:definitions>
\ No newline at end of file



Mime
View raw message