IBM Support

PK94355: THE JAVAX.XML.STREAM.XMLSTREAMWRITER CLOSE() METHOD CLOSES THE OUTPUTSTREAM.

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The javax.xml.stream.XMLStreamWriter close() method closes the
    OutputStream which is not the correct behavior.
    
    Example:
    
    XMLOutputFactory xOF = XMLOutputFactory.newInstance();
    OutputStream oStr = new FileOutputStream("c:/temp/temp.txt");
    XMLStreamWriter xSW = xOF.createXMLStreamWriter(oStr);
    xSW.writeStartDocument();
    xSW.writeStartElement("foo");
    xSW.writeCharacters("bar");
    xSW.writeEndElement();
    xSW.writeEndDocument();
    xSW.close();  // this will close oStr.
    
    oStr.write("\n\nMore Stuff\n".getBytes());  // exception thrown
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  All IBM WebSphere Application Server users  *
    *                  of StAX.                                    *
    ****************************************************************
    * PROBLEM DESCRIPTION: The IBM StAX serializer closes the      *
    *                      OutputStream when                       *
    *                      XMLStreamWriter.close() is called       *
    ****************************************************************
    * RECOMMENDATION:  Install a fix pack that contains this APAR. *
    ****************************************************************
    The IBM javax.xml.stream.XMLStreamWriter close() method closes
    the OutputStream which is not the correct behavior. The StAX
    specification clearly states that this method is not allowed to
    close the underlying OutputStream.
    
    Example:
    
    XMLOutputFactory xOF = XMLOutputFactory.newInstance();
    OutputStream oStr = new FileOutputStream("c:/temp/temp.txt");
    XMLStreamWriter xSW = xOF.createXMLStreamWriter(oStr);
    xSW.writeStartDocument();
    xSW.writeStartElement("foo");
    xSW.writeCharacters("bar");
    xSW.writeEndElement();
    xSW.writeEndDocument();
    xSW.close();  // this will close oStr.
    
    oStr.write("More Stuff".getBytes()); // exception thrown
    
    The exception thrown depends on the type of OutputStream and
    the operation performed on it.  One possibility is
    java.io.IOException.
    

Problem conclusion

  • When close() is called on the IBM XMLStreamWriter it was also
    closing the underlying OutputStream. This behaviour was not
    conformant to the StAX specification which clearly states that
    a call to the close() method will not close the underlying
    OutputStream.
    
    The XMLStreamWriter was fixed so that it will no longer close
    the application's OutputStream.
    
    APAR PK94355 is currently targeted for inclusion in Service
    Level (Fix Pack) 6.1.0.31 of WebSphere Application Server V6.1.
    

Temporary fix

Comments

APAR Information

  • APAR number

    PK94355

  • Reported component name

    WEBSERVIC FEATU

  • Reported component ID

    5724J0850

  • Reported release

    61A

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2009-08-20

  • Closed date

    2010-01-22

  • Last modified date

    2010-01-22

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    WEBSPHERE APP S

  • Fixed component ID

    5724J0800

Applicable component levels

  • R61A PSY

       UP

  • R61H PSY

       UP

  • R61I PSY

       UP

  • R61P PSY

       UP

  • R61S PSY

       UP

  • R61W PSY

       UP

  • R61Z PSY

       UP

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"6.1","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
29 December 2021