Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-5237

Endless loop then OutOfMemory Exception while parsing <xs:choice minOccurs="0" maxOccurs="unbounded">

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.6.1
    • None
    • client-api
    • None
    • XP, Java 6

    Description

      The WSDL:

      <?xml version="1.0" encoding="UTF-8"?>
      <wsdl:definitions targetNamespace="http://carin-blg.de/" xmlns:axis2="http://carin-blg.de/" xmlns:ns="http://carin-blg.de/xmlschema"
      xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
      xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/">
      <wsdl:types>
      <xs:schema elementFormDefault="qualified" targetNamespace="http://carin-blg.de/xmlschema" xmlns="http://carin-blg.de/xmlschema"
      xmlns:xs="http://www.w3.org/2001/XMLSchema">

      <!-- Attribute ==================================================== -->
      <!-- Attribute name -->
      <xs:simpleType name="t_name">
      <xs:restriction base="xs:string">
      <xs:pattern value="[a-zA-Z0-9_üöäßÜÖÄ.-]+" />
      </xs:restriction>
      </xs:simpleType>
      <!-- Attribute value -->
      <xs:simpleType name="t_value">
      <xs:restriction base="xs:string">
      </xs:restriction>
      </xs:simpleType>
      <!-- Attribute type -->
      <xs:simpleType name="t_type">
      <xs:restriction base="xs:string">
      <xs:enumeration value="integer" />
      <xs:enumeration value="number" />
      <xs:enumeration value="alpha" />
      </xs:restriction>
      </xs:simpleType>

      <!-- typen komplexer Felder ==================================================== -->
      <!-- Ein nicht veränderbarer Text -->
      <xs:complexType name="t_text">
      <xs:sequence>
      <xs:element maxOccurs="1" minOccurs="0" name="dummy" type="xs:string" />
      </xs:sequence>
      <xs:attribute name="n" type="t_name">
      </xs:attribute>
      </xs:complexType>

      <!-- Ein veränderbarer Text -->
      <xs:complexType name="t_textfield">
      <xs:sequence>
      <xs:element maxOccurs="1" minOccurs="0" name="dummy" type="xs:string" />
      </xs:sequence>
      <xs:attribute name="n" type="t_name">
      </xs:attribute>
      </xs:complexType>

      <!-- Ein veränderbares Feld eines Typs -->
      <xs:complexType name="t_field">
      <xs:simpleContent>
      <xs:extension base="xs:string">
      <xs:attribute name="n" type="t_name" use="required" />
      </xs:extension>
      </xs:simpleContent>
      </xs:complexType>

      <!-- Ein veränderbarer Parameter -->
      <xs:complexType name="t_parameter">
      <xs:simpleContent>
      <xs:extension base="xs:string">
      <xs:attribute name="n" type="t_name" use="required" />
      <xs:attribute name="val" type="t_value" use="optional" />
      </xs:extension>
      </xs:simpleContent>
      </xs:complexType>

      <xs:complexType name="t_requestparameter">
      <xs:simpleContent>
      <xs:extension base="xs:string">
      <xs:attribute name="name" type="t_name" use="required" />
      <xs:attribute name="val" type="t_value" use="optional" />
      </xs:extension>
      </xs:simpleContent>
      </xs:complexType>

      <xs:complexType name="t_login">
      <xs:all>
      <xs:element maxOccurs="1" minOccurs="1" name="user" type="xs:string" />
      <xs:element maxOccurs="1" minOccurs="1" name="pwd" type="xs:string" />
      </xs:all>
      </xs:complexType>
      <xs:complexType name="header">
      <xs:all>
      <xs:element maxOccurs="1" minOccurs="1" name="timestamp" type="xs:dateTime" />
      <xs:element maxOccurs="1" minOccurs="0" name="listmessageid" type="listmessageid" />
      <xs:element maxOccurs="1" minOccurs="0" name="user" type="xs:string" />
      <xs:element maxOccurs="1" minOccurs="0" name="pwd" type="xs:string" />
      <xs:element maxOccurs="1" minOccurs="1" name="address" type="xs:string" />
      </xs:all>
      </xs:complexType>
      <xs:complexType name="listmessageid">
      <xs:sequence>
      <xs:element maxOccurs="unbounded" minOccurs="1" name="messageid" type="xs:string" />
      </xs:sequence>
      </xs:complexType>

      <xs:complexType name="t_group">
      <xs:choice minOccurs="1" maxOccurs="unbounded">
      <xs:element minOccurs="1" maxOccurs="unbounded" name="f" type="t_field" />
      <xs:element minOccurs="1" maxOccurs="unbounded" name="tf" type="t_textfield" />
      <xs:element minOccurs="1" maxOccurs="unbounded" name="t" type="t_text" />
      <xs:element minOccurs="1" maxOccurs="unbounded" name="p" type="t_parameter" />
      </xs:choice>
      </xs:complexType>

      <xs:complexType name="result">
      <xs:all>
      <xs:element minOccurs="0" name="errorcode" type="xs:string" />
      <xs:element minOccurs="0" name="errortext" type="xs:string" />
      </xs:all>
      </xs:complexType>

      <xs:element name="request">
      <xs:complexType>
      <xs:sequence maxOccurs="1" minOccurs="1">
      <xs:element minOccurs="1" maxOccurs="1" name="header" type="header" />
      <xs:element minOccurs="1" maxOccurs="1" name="operation" type="xs:string" />
      <xs:sequence minOccurs="0" maxOccurs="1">
      <xs:element minOccurs="1" maxOccurs="unbounded" name="parameter" type="t_requestparameter" />
      </xs:sequence>
      </xs:sequence>
      </xs:complexType>
      </xs:element>

      <xs:element name="response">
      <xs:complexType>
      <xs:sequence minOccurs="1" maxOccurs="1">
      <xs:element minOccurs="1" name="header" type="header" />
      <xs:element minOccurs="1" maxOccurs="1" name="operation" type="xs:string" />
      <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element minOccurs="0" maxOccurs="unbounded" name="f" type="t_field" />
      <xs:element minOccurs="0" maxOccurs="unbounded" name="tf" type="t_textfield" />
      <xs:element minOccurs="0" maxOccurs="unbounded" name="t" type="t_text" />
      <xs:element minOccurs="0" maxOccurs="unbounded" name="p" type="t_parameter" />
      <xs:element minOccurs="0" maxOccurs="unbounded" name="g" type="t_group" />
      </xs:choice>
      <xs:element minOccurs="0" maxOccurs="1" name="result" type="result" />
      </xs:sequence>
      </xs:complexType>
      </xs:element>

      </xs:schema>
      </wsdl:types>
      <wsdl:message name="request">
      <wsdl:part name="part1" element="ns:request">
      </wsdl:part>
      </wsdl:message>
      <wsdl:message name="response">
      <wsdl:part name="part2" element="ns:response">
      </wsdl:part>
      </wsdl:message>
      <wsdl:portType name="TrafficLightServicePortType">
      <wsdl:operation name="call">
      <wsdl:input message="axis2:request">
      </wsdl:input>
      <wsdl:output message="axis2:response">
      </wsdl:output>
      </wsdl:operation>
      </wsdl:portType>
      <wsdl:binding name="TrafficLightServiceSOAP11Binding" type="axis2:TrafficLightServicePortType">
      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
      <wsdl:operation name="call">
      <soap:operation soapAction="call" style="document" />
      <wsdl:input>
      <soap:body use="literal" namespace="http://carin-blg.de/" />
      </wsdl:input>
      <wsdl:output>
      <soap:body use="literal" namespace="http://carin-blg.de/" />
      </wsdl:output>
      </wsdl:operation>
      </wsdl:binding>
      <wsdl:binding name="TrafficLightServiceSOAP12Binding" type="axis2:TrafficLightServicePortType">
      <soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
      <wsdl:operation name="call">
      <soap12:operation soapAction="call" style="document" />
      <wsdl:input>
      <soap12:body use="literal" namespace="http://carin-blg.de/" />
      </wsdl:input>
      <wsdl:output>
      <soap12:body use="literal" namespace="http://carin-blg.de/" />
      </wsdl:output>
      </wsdl:operation>
      </wsdl:binding>
      <wsdl:service name="TrafficLightService">
      <wsdl:port name="TrafficLightServiceSOAP12port" binding="axis2:TrafficLightServiceSOAP12Binding">
      <soap:address location="http://localhost:9080/axis2/services/TrafficLightService" />
      </wsdl:port>
      </wsdl:service>
      </wsdl:definitions>

      The generated Stub (Part):

      ...

      } // End of if for expected property start element

      else

      { // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName()); }

      while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

      try{

      if (reader.isStartElement() ){

      // Process the array and step past its final element's end.
      list3.add(ResponseChoice_type0.Factory.parse(reader));
      //loop until we find a start element that is not part of this array
      boolean loopDone3 = false;
      while(!loopDone3){

      // Step to next element event.
      while (!reader.isStartElement() && !reader.isEndElement())
      reader.next();
      if (reader.isEndElement())

      { //two continuous end elements means we are exiting the xml structure loopDone3 = true; }

      else

      { list3.add(ResponseChoice_type0.Factory.parse(reader)); }

      }
      // call the converter utility to convert and set the array
      object.setResponseChoice_type0((ResponseChoice_type0[])
      org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
      ResponseChoice_type0.class,
      list3));

      } // End of if for expected property start element

      else {

      }

      } catch (java.lang.Exception e) {}

      while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

      if (reader.isStartElement() && new javax.xml.namespace.QName("http://carin-blg.de/xmlschema","result").equals(reader.getName()))

      { object.setResult(Result.Factory.parse(reader)); reader.next(); }

      // End of if for expected property start element

      else {

      ....

      The line
      list3.add(ResponseChoice_type0.Factory.parse(reader));

      loops indefinte end leads to OutOfMemoryException.

      TCPMon inspected Result:
      HTTP/1.1 200 OK
      Server: Apache-Coyote/1.1
      Content-Type: application/soap+xml; action="http://carin-blg.de/TrafficLightServicePortType/callResponse";charset=UTF-8
      Transfer-Encoding: chunked
      Date: Thu, 02 Feb 2012 17:38:18 GMT

      229
      <?xml version='1.0' encoding='UTF-8'?>
      <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
      <soapenv:Body>
      <ns1:response xmlns:ns1="http://carin-blg.de/xmlschema">
      <ns1:header>
      <ns1:timestamp>2012-02-02T18:38:18.032+01:00</ns1:timestamp>
      <ns1:listmessageid>
      <ns1:messageid>2012-02-02T18:38:16.595+0100</ns1:messageid>
      </ns1:listmessageid>
      <ns1:address>10.10.20.10</ns1:address>
      </ns1:header>
      <ns1:operation>function</ns1:operation>
      <ns1:result>
      <ns1:errorcode>0</ns1:errorcode>
      <ns1:errortext>No Error</ns1:errortext>
      </ns1:result>
      </ns1:response>
      22

      </soapenv:Body>
      </soapenv:Envelope>0

      Stack Trace:
      Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
      at java.util.Arrays.copyOf(Unknown Source)
      at java.util.Arrays.copyOf(Unknown Source)
      at java.util.ArrayList.ensureCapacity(Unknown Source)
      at java.util.ArrayList.add(Unknown Source)
      at client.adb.TrafficLightServiceStub$Response$Factory.parse(TrafficLightServiceStub.java:1072)
      at client.adb.TrafficLightServiceStub.fromOM(TrafficLightServiceStub.java:10111)
      at client.adb.TrafficLightServiceStub.call(TrafficLightServiceStub.java:193)
      at client.adb.ADBClient.call(ADBClient.java:39)
      at client.adb.ADBClient.main(ADBClient.java:10)

      Environment: XP, AXIS2 1.6.1, Tomcat 7

      Attachments

        Activity

          People

            Unassigned Unassigned
            jo Joachim Unger
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: