IBM Support

PK94355; 6.1.0.25: IBM StAX serializer closes the OutputStream

Download


Abstract

The IBM StAX serializer closes the OutputStream when XMLStreamWriter.close() is called

Download Description

PK94355 resolves the following problem:

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:
None

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.

Prerequisites

Please download the UpdateInstaller below to install this fix.

[{"PRLabel":"UpdateInstaller","PRLang":"US English","PRSize":"7250000","PRPlat":{"label":"AIX","code":"PF002"},"PRURL":"http://www.ibm.com/support/docview.wss?rs=180&uid=swg21205991"}]

Installation Instructions

Please review the readme.txt for detailed installation instructions.

[{"INLabel":"Readme","INLang":"US English","INSize":"9234","INURL":"ftp://public.dhe.ibm.com/software/websphere/appserv/support/fixes/PK94355/readme.txt"}]
On
[{"DNLabel":"6.1.0.25-WS-AppClientWebSvc-IFPK943","DNDate":"11/20/2009","DNLang":"US English","DNSize":"41869","DNPlat":{"label":"AIX","code":"PF002"},"DNURL":"https://www.ibm.com/support/fixcentral/quickorder?fixids=6.1.0.25-WS-AppClientWebSvc-IFPK94355&product=ibm%2FWebSphere%2FWebSphere%20Application%20Server&source=dbluesearch","DNURL_FTP":"ftp://public.dhe.ibm.com/software/websphere/appserv/support/fixes/PK94355/6.1.0.25-WS-AppClientWebSvc-IFPK94355.pak","DDURL":"http://public.dhe.ibm.com:7618;sw_websphere;appserv/support/fixes/PK94355/6.1.0.25-WS-AppClientWebSvc-IFPK94355.pak"}]

Technical Support

Contact IBM Support using SR (http://www.ibm.com/software/support/probsub.html), visit the WebSphere Application Server Support Web site (http://www.ibm.com/software/webservers/appserv/was/support/), or contact 1-800-IBM-SERV (U.S. only).

[{"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Web Services (for example: SOAP or UDDI or WSGW or WSIF)","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF012","label":"IBM i"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"6.1.0.25","Edition":"Feature Pack for Web Services","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
07 December 2019

UID

swg24025100