cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r572631 - in /incubator/cxf/trunk/tools/wsdlto: frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/ test/src/test/resources/wsdl2java_wsdl/
Date Tue, 04 Sep 2007 11:44:51 GMT
Author: mmao
Date: Tue Sep  4 04:44:50 2007
New Revision: 572631

URL: http://svn.apache.org/viewvc?rev=572631&view=rev
Log:
CXF-967
  * Fix the NPE in case of parameter ordering and no output message


Added:
    incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/bug967.wsdl
Modified:
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
    incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java?rev=572631&r1=572630&r2=572631&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ParameterProcessor.java
Tue Sep  4 04:44:50 2007
@@ -20,6 +20,7 @@
 package org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -28,7 +29,6 @@
 import javax.wsdl.OperationType;
 import javax.xml.namespace.QName;
 
-
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.jaxb.JAXBUtils;
@@ -487,13 +487,20 @@
                                               MessageInfo inputMessage,
                                               MessageInfo outputMessage,
                                               List<String> parameterList) throws ToolException
{
-
         Map<QName, MessagePartInfo> inputPartsMap = inputMessage.getMessagePartsMap();
 
-        Map<QName, MessagePartInfo> outputPartsMap = outputMessage.getMessagePartsMap();
+        Map<QName, MessagePartInfo> outputPartsMap = new HashMap<QName, MessagePartInfo>();
+        
+        if (outputMessage != null) {
+            outputPartsMap = outputMessage.getMessagePartsMap();
+        }
 
         List<MessagePartInfo> inputParts = inputMessage.getMessageParts();
-        List<MessagePartInfo> outputParts = outputMessage.getMessageParts();
+        List<MessagePartInfo> outputParts = new ArrayList<MessagePartInfo>();
+
+        if (outputMessage != null) {
+            outputMessage.getMessageParts();
+        }
 
         List<MessagePartInfo> inputUnlistedParts = new ArrayList<MessagePartInfo>();
         List<MessagePartInfo> outputUnlistedParts = new ArrayList<MessagePartInfo>();
@@ -521,6 +528,8 @@
             } else {
                 processReturn(method, null);
             }
+        } else {
+            processReturn(method, null);
         }
 
         // now create list of paramModel with parts
@@ -573,7 +582,11 @@
         Iterator<String> params = parameterOrder.iterator();
 
         List<MessagePartInfo> inputParts = inputMessage.getMessageParts();
-        List<MessagePartInfo> outputParts = outputMessage.getMessageParts();
+        List<MessagePartInfo> outputParts = new ArrayList<MessagePartInfo>();
+
+        if (outputMessage != null) {
+            outputParts = outputMessage.getMessageParts();
+        }
 
         boolean partFound = false;
 

Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=572631&r1=572630&r2=572631&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Tue Sep  4 04:44:50 2007
@@ -665,4 +665,16 @@
             assertEquals(msg.toString().trim(), e.getMessage().trim());
         }
     }
+
+    @Test
+    public void testParamterOrderNoOutputMessage() throws Exception {
+        try {
+            env.put(ToolConstants.CFG_WSDLURL,
+                    getLocation("/wsdl2java_wsdl/bug967.wsdl"));
+            processor.setContext(env);
+            processor.execute();
+        } catch (Exception e) {
+            fail("The cxf967.wsdl is a valid wsdl, should pass the test, caused by: " + e.getMessage());
+        }
+    }
 }

Added: incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/bug967.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/bug967.wsdl?rev=572631&view=auto
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/bug967.wsdl (added)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/bug967.wsdl Tue
Sep  4 04:44:50 2007
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<wsdl:definitions name="VoidVoid" targetNamespace="http://apache.org/hello_world_rpclit/voidvoid"

+    xmlns="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:http-conf="http://schemas.iona.com/transports/http/configuration"
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
+    xmlns:tns="http://apache.org/hello_world_rpclit/voidvoid"
+    xmlns:x1="http://apache.org/hello_world_rpclit/voidvoid/types"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+    
+    <wsdl:message name="sayHiRequest">
+	<wsdl:part name="inInt" type="xsd:int"/>
+    </wsdl:message>
+    
+    <wsdl:portType name="GreeterRPCLit">
+        <wsdl:operation name="sayHi" parameterOrder="inInt">
+            <wsdl:input message="tns:sayHiRequest" name="sayHiRequest"/>
+        </wsdl:operation>
+    </wsdl:portType>
+    
+    <wsdl:binding name="Greeter_SOAPBinding_RPCLit" type="tns:GreeterRPCLit">
+        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+        
+        <wsdl:operation name="sayHi">
+            <soap:operation soapAction="" style="rpc"/>
+	    <wsdl:input>
+                <soap:body namespace="http://apache.org/hello_world_rpclit/voidvoid" use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body namespace="http://apache.org/hello_world_rpclit/voidvoid" use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        
+    </wsdl:binding>
+    
+    <wsdl:service name="SOAPServiceRPCLit">
+        <wsdl:port binding="tns:Greeter_SOAPBinding_RPCLit" name="SoapPortRPCLit">
+            <soap:address location="http://localhost:9000/SoapContext/SoapPort"/>
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>



Mime
View raw message