Uploaded image for project: 'StAXMapper'
  1. StAXMapper
  2. STXM-5

Attempt to write Attributes after moving on from element.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.1.0.Final
    • 1.0.0.Beta3
    • core
    • None
    • Hide

      Reproducible using the detyped2 branch but should be reproducible by starting AS7 with staxmapper updated to Beta3

      Show
      Reproducible using the detyped2 branch but should be reproducible by starting AS7 with staxmapper updated to Beta3

      The ServerModel within AS7 contains the following loop: -

      if (! extensions.isEmpty()) {
      streamWriter.writeStartElement(Element.EXTENSIONS.getLocalName());
      for (String extension : extensions)

      { streamWriter.writeEmptyElement(Element.EXTENSION.getLocalName()); streamWriter.writeAttribute(Attribute.MODULE.getLocalName(), extension); }

      streamWriter.writeEndElement();
      }

      Each call to writeEmptyElement causes the previous writeAttribute to be executed, as the for loop completes there is one pending writeAttribute, the subsequent writeEndElement call does not write this attribute first leaving the call to write it happening later.

      The AS7 start up reports this problem as: -

      Caused by: javax.xml.stream.XMLStreamException: Attribute not associated with any element
      at com.sun.xml.internal.stream.writers.XMLStreamWriterImpl.writeAttribute(XMLStreamWriterImpl.java:521) [:1.6.0_23]
      at org.jboss.staxmapper.FormattingXMLStreamWriter$4.run(FormattingXMLStreamWriter.java:224)
      ... 11 more

      However it is also conceivable that this element could be written to an incorrect element.

            darran.lofthouse@redhat.com Darran Lofthouse
            darran.lofthouse@redhat.com Darran Lofthouse
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: