XMLStreamSerializer -  IllegalStateException caused by unnecessary 
XMLStreamWriter calls
----------------------------------------------------------------------------------------

                 Key: TUSCANY-1818
                 URL: https://issues.apache.org/jira/browse/TUSCANY-1818
             Project: Tuscany
          Issue Type: Improvement
    Affects Versions: Java-SCA-Next
            Reporter: Scott Kurz
            Priority: Minor


Hit the following error when using an XLXP impl of StAX. 

java.lang.IllegalStateException: writeNamespace() can only be called following 
writeStartElement() or writeEmptyElement().
        at 
com.ibm.xml.xlxp.api.stax.msg.StAXMessageProvider.throwIllegalStateException(StAXMessageProvider.java:45)
        at 
com.ibm.xml.xlxp.api.stax.XMLStreamWriterBase.writeNamespace(XMLStreamWriterBase.java:514)
        at 
com.ibm.xml.xlxp.api.stax.XMLOutputFactoryImpl$XMLStreamWriterProxy.writeNamespace(XMLOutputFactoryImpl.java:148)
        at 
org.apache.tuscany.sca.databinding.xml.XMLStreamSerializer.serializeNamespace(XMLStreamSerializer.java:227)
        at 
org.apache.tuscany.sca.databinding.xml.XMLStreamSerializer.serializeElement(XMLStreamSerializer.java:198)
        at 
org.apache.tuscany.sca.databinding.xml.XMLStreamSerializer.serializeNode(XMLStreamSerializer.java:243)
        at 
org.apache.tuscany.sca.databinding.xml.XMLStreamSerializer.serialize(XMLStreamSerializer.java:70)
        at 
org.apache.tuscany.sca.databinding.xml.StAXHelper.save(StAXHelper.java:76)


Call sequence of:

  writer.writeStartElement(...)
  writer.writeNamespace(...)
  writer.setPrefix(...)
  writer.writeNamespace(...)
  writer.setPrefix(...)

is not tolerated by XLXP.     

I believe the setPrefix() calls are unnecessary since the prefix is passed into 
writeNamespace(), and that this should be fine with other Stax impls like 
Woodstox.  

I'll attach a patch today. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to