Uploaded image for project: 'Axis'
  1. Axis
  2. AXIS-1337

Regression in WSDL2Java caused by change in Utils.java

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • WSDL processing
    • None
    • Current cvs tree (4262004) on Win XP

    Description

      If xsd:schema element is removed from the WSDL, the WSDL2Java is throwing an NPE in the beta-1 src tree.

      For example, consider the following WSDL snippet..

      <types>
      <!-xsd:schema targetNamespace="http://MyService"->
      <xsd:element name="MyString" type="xsd:string"/>
      <!-/xsd:schema->
      </types>

      Running this WSDL (attached) produces no errors in Axis 1.1, but throws the following NPE on 1.2

      java.lang.NullPointerException
      at org.apache.axis.wsdl.symbolTable.Utils.getNodeNameQName(Utils.java:26
      7)
      at org.apache.axis.wsdl.symbolTable.SymbolTable.createTypeFromDef(Symbol
      Table.java:1095)
      at org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes(SymbolTable.jav
      a:971)
      at org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes(SymbolTable.jav
      a:1077)
      at org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes(SymbolTable.jav
      a:1077)
      at org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes(SymbolTable.jav
      a:1077)
      at org.apache.axis.wsdl.symbolTable.SymbolTable.populateTypes(SymbolTabl
      e.java:894)
      at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.jav
      a:692)
      at org.apache.axis.wsdl.symbolTable.SymbolTable.add(SymbolTable.java:531
      )
      at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.jav
      a:506)
      at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.jav
      a:483)
      at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:356)
      at java.lang.Thread.run(Thread.java:536)

      On further investigation it seems that the cause is a change in the class org.apache.axis.wsdl.symbolTable.Utils.java between the 1.30.2.1 and the 1.30 versions:

      http://cvs.apache.org/viewcvs.cgi/ws-axis/java/src/org/apache/axis/wsdl/symbolTable/Utils.java?r1=1.30&r2=1.30.2.1&diff_format=h

      Note that in the current version the code section under the following comment has changed....

      // This routine may be called for complexType elements. In some cases
      // the complexType may be anonymous, which is why the
      // getScopedAttribute method is used.

      The code section is no longer inside the if (localName == null) code block.

      As a result if the xsd:schema element is removed from the WSDL, the search goes on till it hits the XML declaration for which the kind variable (line 265) returns null. This results in the NPE.

      Omitting the xsd:schema may result in an incorrect WSDL, but an NPE should not be thrown. If the xsd:schema is not found, a proper error message should be generate.

      Attachments

        1. test-npe.wsdl
          2 kB
          Shantanu Sen
        2. Utils.java
          27 kB
          Shantanu Sen

        Activity

          People

            Unassigned Unassigned
            ssen Shantanu Sen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: