Fixes are available
PK94355; 6.1.0.25: IBM StAX serializer closes the OutputStream
6.1.0.31: Java SDK 1.5 SR11 FP1 Cumulative Fix for WebSphere Application Server
6.1.0.33: Java SDK 1.5 SR12 FP1 Cumulative Fix for WebSphere
6.1.0.35: Java SDK 1.5 SR12 FP2 Cumulative Fix for WebSphere
6.1.0.37: Java SDK 1.5 SR12 FP3 Cumulative Fix for WebSphere
6.1.0.47: WebSphere Application Server V6.1 Fix Pack 47
6.1.0.39: Java SDK 1.5 SR12 FP4 Cumulative Fix for WebSphere Application Server
6.1.0.41: Java SDK 1.5 SR12 FP5 Cumulative Fix for WebSphere Application Server
6.1.0.43: Java SDK 1.5 SR13 Cumulative Fix for WebSphere Application Server
6.1.0.45: Java SDK 1.5 SR14 Cumulative Fix for WebSphere Application Server
6.1.0.47: Java SDK 1.5 SR16 Cumulative Fix for WebSphere Application Server
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
Document Information
Modified date:
29 December 2021