Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-1657

CheckFaultInterceptor causes XMLStreamReader to throw IllegalState at doc end

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1
    • 2.1.2, 2.0.9
    • Soap Binding
    • None

    Description

      From handleMessage():
      :
      try {
      // advance to first tag.
      int x = xmlReader.getEventType();
      while (x != XMLStreamReader.START_ELEMENT
      && x != XMLStreamReader.END_ELEMENT
      && xmlReader.hasNext())

      { x = xmlReader.next(); }
      } catch (XMLStreamException e) { throw new SoapFault(new Message("XML_STREAM_EXC", LOG), e, message.getVersion().getSender()); }
      if (message.getVersion().getFault().equals(xmlReader.getName())) {
      :
      In the case where hasNext() == false (e.g. document end) will cause the subsequent call to xmlReader.getName() to throw an IllegalStateException, as per the javax.xml.stream,XMLStreamReader interface. It would seem the appropriate response would be to simply return in this case:

      :
      try {
      // advance to first tag.
      int x = xmlReader.getEventType();
      while (x != XMLStreamReader.START_ELEMENT
      && x != XMLStreamReader.END_ELEMENT
      && xmlReader.hasNext()) { x = xmlReader.next(); }

      if ( x==XMLStreamReader.END_DOCUMENT) return;
      } catch (XMLStreamException e) {
      :

      Attachments

        Activity

          People

            dkulp Daniel Kulp
            jaysonraymond Jayson Raymond
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: