Author: veithen
Date: Wed Feb 26 11:43:39 2014
New Revision: 1572021

URL: http://svn.apache.org/r1572021
Log:
AXIS-2900: A fault message referring to an element and that has the same name 
as an element (typically the element it refers to) doesn't cause any collision 
(because no class is generated for the fault message) and the class name 
corresponding to the element shouldn't be mangled.

Added:
    axis/axis1/java/trunk/axis-ant/src/test/ant/axis2900/
    axis/axis1/java/trunk/axis-ant/src/test/ant/axis2900/build.xml   (with 
props)
    axis/axis1/java/trunk/axis-ant/src/test/java/test/wsdl/axis2900/
    
axis/axis1/java/trunk/axis-ant/src/test/java/test/wsdl/axis2900/VerifyFilesTestCase.java
   (with props)
    axis/axis1/java/trunk/axis-ant/src/test/wsdl/axis2900/
    axis/axis1/java/trunk/axis-ant/src/test/wsdl/axis2900/sample.wsdl
Modified:
    axis/axis1/java/trunk/axis-ant/pom.xml
    
axis/axis1/java/trunk/axis-codegen/src/main/java/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java

Modified: axis/axis1/java/trunk/axis-ant/pom.xml
URL: 
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-ant/pom.xml?rev=1572021&r1=1572020&r2=1572021&view=diff
==============================================================================
--- axis/axis1/java/trunk/axis-ant/pom.xml (original)
+++ axis/axis1/java/trunk/axis-ant/pom.xml Wed Feb 26 11:43:39 2014
@@ -78,6 +78,7 @@
                             <target>
                                 <taskdef name="java2wsdl" 
classname="org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask" 
classpathref="maven.compile.classpath" />
                                 <taskdef name="wsdl2java" 
classname="org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask" 
classpathref="maven.compile.classpath" />
+                                <ant antfile="src/test/ant/axis2900/build.xml" 
target="test" inheritrefs="true" />
                                 <ant antfile="src/test/ant/clash/build.xml" 
target="test" inheritrefs="true" />
                                 <ant antfile="src/test/ant/extra/build.xml" 
target="test" inheritrefs="true" />
                                 <ant antfile="src/test/ant/filegen/build.xml" 
target="test" inheritrefs="true" />

Added: axis/axis1/java/trunk/axis-ant/src/test/ant/axis2900/build.xml
URL: 
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-ant/src/test/ant/axis2900/build.xml?rev=1572021&view=auto
==============================================================================
--- axis/axis1/java/trunk/axis-ant/src/test/ant/axis2900/build.xml (added)
+++ axis/axis1/java/trunk/axis-ant/src/test/ant/axis2900/build.xml Wed Feb 26 
11:43:39 2014
@@ -0,0 +1,10 @@
+<?xml version="1.0" ?>
+<project>
+  <target name="test">
+    <mkdir dir="${project.build.directory}/work"/>
+    <wsdl2java url="src/test/wsdl/axis2900/sample.wsdl"
+               output="${project.build.directory}/work">
+      <mapping namespace="http://example.com"; package="test.wsdl.axis2900"/>
+    </wsdl2java>
+  </target>
+</project>

Propchange: axis/axis1/java/trunk/axis-ant/src/test/ant/axis2900/build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
axis/axis1/java/trunk/axis-ant/src/test/java/test/wsdl/axis2900/VerifyFilesTestCase.java
URL: 
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-ant/src/test/java/test/wsdl/axis2900/VerifyFilesTestCase.java?rev=1572021&view=auto
==============================================================================
--- 
axis/axis1/java/trunk/axis-ant/src/test/java/test/wsdl/axis2900/VerifyFilesTestCase.java
 (added)
+++ 
axis/axis1/java/trunk/axis-ant/src/test/java/test/wsdl/axis2900/VerifyFilesTestCase.java
 Wed Feb 26 11:43:39 2014
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+package test.wsdl.axis2900;
+
+import test.AxisFileGenTestBase;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.Set;
+
+public class VerifyFilesTestCase extends AxisFileGenTestBase {
+    public VerifyFilesTestCase(String name) {
+        super(name);
+    }
+
+    /**
+     * List of files which should be generated.
+     */
+    protected Set shouldExist() {
+        HashSet set = new HashSet();
+        set.add("Exception.java");
+        set.add("MyWS.java");
+        set.add("MyWSException.java");
+        set.add("MyWSLocator.java");
+        set.add("MyWSPortType.java");
+        set.add("MyWSSoap11BindingStub.java");
+        return set;
+    } // shouldExist
+
+    /**
+     * List of files which may be generated.
+     */
+    protected Set mayExist() {
+        HashSet set = new HashSet();
+        return set;
+    } // shouldExist
+
+    /**
+     * The directory containing the files that should exist.
+     */
+    protected String rootDir() {
+        return "target" + File.separator + "work" + File.separator + 
+                "test" + File.separator + "wsdl" + File.separator +
+                "axis2900";
+    } // rootDir
+
+} // class VerifyFilesTestCase

Propchange: 
axis/axis1/java/trunk/axis-ant/src/test/java/test/wsdl/axis2900/VerifyFilesTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: axis/axis1/java/trunk/axis-ant/src/test/wsdl/axis2900/sample.wsdl
URL: 
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-ant/src/test/wsdl/axis2900/sample.wsdl?rev=1572021&view=auto
==============================================================================
--- axis/axis1/java/trunk/axis-ant/src/test/wsdl/axis2900/sample.wsdl (added)
+++ axis/axis1/java/trunk/axis-ant/src/test/wsdl/axis2900/sample.wsdl Wed Feb 
26 11:43:39 2014
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:ns1="http://org.apache.axis2/xsd"; xmlns:ns="http://example.com"; 
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"; 
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; 
xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"; 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"; 
targetNamespace="http://example.com";>
+    <wsdl:documentation>
+               Please Type your service description here
+       </wsdl:documentation>
+    <wsdl:types>
+        <xs:schema attributeFormDefault="qualified" 
elementFormDefault="qualified" targetNamespace="http://example.com";>
+            <xs:element name="MyWSException">
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element minOccurs="0" name="MyWSException" 
nillable="true" type="ns:Exception"/>
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
+            <xs:complexType name="Exception">
+                <xs:sequence>
+                    <xs:element minOccurs="0" name="Message" nillable="true" 
type="xs:string"/>
+                </xs:sequence>
+            </xs:complexType>
+            <xs:element name="myOperation">
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element minOccurs="0" name="myId" nillable="true" 
type="xs:string"/>
+                        <xs:element minOccurs="0" name="myOt" nillable="true" 
type="xs:string"/>
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
+            <xs:element name="myOperationResponse">
+                <xs:complexType>
+                    <xs:sequence>
+                        <xs:element minOccurs="0" name="return" 
nillable="true" type="xs:string"/>
+                    </xs:sequence>
+                </xs:complexType>
+            </xs:element>
+           
+        </xs:schema>
+    </wsdl:types>
+    <wsdl:message name="myOperationRequest">
+        <wsdl:part name="parameters" element="ns:myOperation"/>
+    </wsdl:message>
+    <wsdl:message name="myOperationResponse">
+        <wsdl:part name="parameters" element="ns:myOperationResponse"/>
+    </wsdl:message>
+    <wsdl:message name="MyWSException">
+        <wsdl:part name="parameters" element="ns:MyWSException"/>
+    </wsdl:message>
+    <wsdl:portType name="MyWSPortType">
+        
+        <wsdl:operation name="myOperation">
+            <wsdl:input message="ns:myOperationRequest" 
wsaw:Action="urn:myOperation"/>
+            <wsdl:output message="ns:myOperationResponse" 
wsaw:Action="urn:myOperationResponse"/>
+            <wsdl:fault message="ns:MyWSException" name="MyWSException" 
wsaw:Action="urn:myOperationMyWSException"/>
+        </wsdl:operation>
+    </wsdl:portType>
+    <wsdl:binding name="MyWSSoap11Binding" type="ns:MyWSPortType">
+        <soap:binding transport="http://schemas.xmlsoap.org/soap/http"; 
style="document"/>
+        
+        <wsdl:operation name="myOperation">
+            <soap:operation soapAction="urn:myOperation" style="document"/>
+            <wsdl:input>
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal"/>
+            </wsdl:output>
+            <wsdl:fault name="MyWSException">
+                <soap:fault use="literal" name="MyWSException"/>
+            </wsdl:fault>
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:service name="MyWS">
+        <wsdl:port name="MyWSHttpSoap11Endpoint" 
binding="ns:MyWSSoap11Binding">
+            <soap:address location="http://endpoint.com"/>
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>

Modified: 
axis/axis1/java/trunk/axis-codegen/src/main/java/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java
URL: 
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-codegen/src/main/java/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java?rev=1572021&r1=1572020&r2=1572021&view=diff
==============================================================================
--- 
axis/axis1/java/trunk/axis-codegen/src/main/java/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java
 (original)
+++ 
axis/axis1/java/trunk/axis-codegen/src/main/java/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java
 Wed Feb 26 11:43:39 2014
@@ -1008,7 +1008,9 @@ public class JavaGeneratorFactory implem
                 if (v.elementAt(index) instanceof MessageEntry) {
                     // Need to resolve a Exception message.
                     MessageEntry msgEntry = (MessageEntry) v.elementAt(index); 
                   
-                    if (msgEntry.getDynamicVar(EXCEPTION_CLASS_NAME) == null) {
+                    // AXIS-2900: Only simple type faults generate additional 
classes; message entries for
+                    // complex type faults don't cause any collisions.
+                    if (Utils.isFaultComplex(msgEntry) || 
msgEntry.getDynamicVar(EXCEPTION_CLASS_NAME) == null) {
                         v.removeElementAt(index);
                     } else {                        
                         index++;


Reply via email to