Stefan May created AXIS2-6049:
---------------------------------

             Summary: Generated Exceptions differ each generation
                 Key: AXIS2-6049
                 URL: https://issues.apache.org/jira/browse/AXIS2-6049
             Project: Axis2
          Issue Type: Improvement
          Components: codegen
    Affects Versions: 1.8.0
            Reporter: Stefan May


*Description:*
The Java files which are generated by the AntCodegenTask for Exceptions differ 
each generation in the serialVersionUID.
This is especially bothering if the gradle cache should be used, wich requires 
a fixed input. Also, the objects may not be deserialized again if the 
SerialVersionUID changes each time.

*Steps to reproduce:*
Create a WSDL with a wsdl:fault element, e.g:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
xmlns:tns="http://www.example.org/"; 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; name="ExampleModule" 
targetNamespace="http://www.example.org/";>
    <wsdl:types>
        <xsd:schema targetNamespace="http://www.example.org/";>
            <xsd:element name="getSolutionById">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="in" type="xsd:string"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
            <xsd:element name="getSolutionByIdResponse">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="out" type="xsd:string"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
            <xsd:element name="getSolutionByIdFault">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="getSolutionByIdFault"
                                     type="xsd:string">
                        </xsd:element>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>

        </xsd:schema>
    </wsdl:types>
    <wsdl:message name="getSolutionByIdRequest">
        <wsdl:part element="tns:getSolutionById" name="parameters"/>
    </wsdl:message>
    <wsdl:message name="getSolutionByIdResponse">
        <wsdl:part element="tns:getSolutionByIdResponse" name="parameters"/>
    </wsdl:message>

    <wsdl:message name="getSolutionByIdFault">
        <wsdl:part name="parameters" 
element="tns:getSolutionByIdFault"></wsdl:part>
    </wsdl:message>
    <wsdl:portType name="ExampleModule">
        <wsdl:operation name="getSolutionById">
            <wsdl:input message="tns:getSolutionByIdRequest"/>
            <wsdl:output message="tns:getSolutionByIdResponse"/>

            <wsdl:fault name="fault" 
message="tns:getSolutionByIdFault"></wsdl:fault>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="ExampleModuleSOAP" type="tns:ExampleModule">
        <soap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="getSolutionById">
            <soap:operation 
soapAction="http://www.example.org/ExampleModule/getSolutionById"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
            <wsdl:fault name="fault">
                <soap:fault use="literal" name="fault" />
            </wsdl:fault>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="ExampleModule">
        <wsdl:port binding="tns:ExampleModuleSOAP" name="ExampleModuleSOAP">
            <soap:address location="http://www.example.org/"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>Generate it again, the serialVersionUID changes
*More info*
I've checked and found the corresponding issue in the file 
[https://github.com/apache/axis-axis2-java-core/blob/master/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java|https://github.com/wso2/wso2-axis2/blob/28a2220ba3a5547315347ecb97b512059070d15d/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java]
 in line 1055, where the {{System.currentTimeMillis()}} is used for the 
serialVersionUID.
A hash based on the className and the parameters would probably be better.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@axis.apache.org
For additional commands, e-mail: java-dev-h...@axis.apache.org

Reply via email to