PK23496: SENDERROR(), IN THE HTTPSERVLETRESPONSE, THROWS AN EXCEPTION IF THE GETOUTPUTSTREAM() HAD PREVIOUSLY BEEN CALLED.

 Fixes are available

5.1.1.17: WebSphere Application Server V5.1.1 Cumulative Fix 17 for AIX
5.1.1.17: WebSphere Application Server V5.1.1 Cumulative Fix 17 for HP-UX
5.1.1.19: WebSphere Application Server V5.1.1 Cumulative Fix 19 for Linux
5.1.1.16: WebSphere Application Server V5.1.1 Cumulative Fix 16 for AIX
5.1.1.18: WebSphere Application Server V5.1.1 Cumulative Fix 18 for AIX
5.1.1.18: WebSphere Application Server V5.1.1 Cumulative Fix 18 for HP-UX
5.1.1.18: WebSphere Application Server V5.1.1 Cumulative Fix 18 for Solaris
5.1.1.18: WebSphere Application Server V5.1.1 Cumulative Fix 18 for Windows
5.1.1.18: WebSphere Application Server V5.1.1 Cumulative Fix 18 for Linux
5.1.1.17: WebSphere Application Server V5.1.1 Cumulative Fix 17 for Linux
5.1.1.17: WebSphere Application Server V5.1.1 Cumulative Fix 17 for Solaris
5.1.1.17: WebSphere Application Server V5.1.1 Cumulative Fix 17 for Windows
5.1.1.19: WebSphere Application Server V5.1.1 Cumulative Fix 19 for AIX
5.1.1.19: WebSphere Application Server V5.1.1 Cumulative Fix 19 for Windows
5.1.1.11: WebSphere Application Server V5.1.1 Cumulative Fix 11 for AIX
5.1.1.12: WebSphere Application Server V5.1.1 Cumulative Fix 12 for Windows
5.1.1.11: WebSphere Application Server V5.1.1 Cumulative Fix 11 for Windows
5.1.1.16: WebSphere Application Server V5.1.1 Cumulative Fix 16 for Solaris
5.0.2.18: WebSphere Application Server 5.0.2 Cumulative Fix 18 for Solaris
5.1.1.11: WebSphere Application Server V5.1.1 Cumulative Fix 11 for Linux
5.0.2.18: WebSphere Application Server 5.0.2 Cumulative Fix 18 for Windows
5.0.2.18: WebSphere Application Server 5.0.2 Cumulative Fix 18 for HP-UX
5.0.2.18: WebSphere Application Server 5.0.2 Cumulative Fix 18 for AIX
5.1.1.16: WebSphere Application Server V5.1.1 Cumulative Fix 16 for Windows
5.1.1.14: WebSphere Application Server V5.1.1 Cumulative Fix 14 for Solaris
5.1.1.12: WebSphere Application Server V5.1.1 Cumulative Fix 12 for AIX
5.1.1.12: WebSphere Application Server V5.1.1 Cumulative Fix 12 for Linux
5.1.1.12: WebSphere Application Server V5.1.1 Cumulative Fix 12 for HP-UX
5.1.1.12: WebSphere Application Server V5.1.1 Cumulative Fix 12 for Solaris
5.1.1.11: WebSphere Application Server V5.1.1 Cumulative Fix 11 for Solaris
5.1.1.13: WebSphere Application Server V5.1.1 Cumulative Fix 13 for AIX
5.1.1.13: WebSphere Application Server V5.1.1 Cumulative Fix 13 for Windows
5.1.1.13: WebSphere Application Server V5.1.1 Cumulative Fix 13 for HP-UX
5.1.1.15: WebSphere Application Server V5.1.1 Cumulative Fix 15 for Solaris
5.1.1.13: WebSphere Application Server V5.1.1 Cumulative Fix 13 for Solaris
5.1.1.13: WebSphere Application Server V5.1.1 Cumulative Fix 13 for Linux
5.1.1.14: WebSphere Application Server V5.1.1 Cumulative Fix 14 for AIX
5.1.1.14: WebSphere Application Server V5.1.1 Cumulative Fix 14 for Linux
5.1.1.14: WebSphere Application Server V5.1.1 Cumulative Fix 14 for Windows
5.1.1.15: WebSphere Application Server V5.1.1 Cumulative Fix 15 for Windows
5.0.2.18: WebSphere Application Server 5.0.2 Cumulative Fix 18 for Linux
5.1.1.11: WebSphere Application Server V5.1.1 Cumulative Fix 11 for HP-UX
5.1.1.14: WebSphere Application Server V5.1.1 Cumulative Fix 14 for HP-UX
5.1.1.15: WebSphere Application Server V5.1.1 Cumulative Fix 15 for AIX
5.1.1.15: WebSphere Application Server V5.1.1 Cumulative Fix 15 for HP-UX
5.1.1.16: WebSphere Application Server V5.1.1 Cumulative Fix 16 for HP-UX
5.1.1.16: WebSphere Application Server V5.1.1 Cumulative Fix 16 for Linux
5.1.1.15: WebSphere Application Server V5.1.1 Cumulative Fix 15 for Linux
5.1.1.19: WebSphere Application Server V5.1.1 Cumulative Fix 19 for HP-UX



APAR status
Closed as program error.

Error description
Environment:
------------
WebSphere Platform 5.1 [BASE 5.1.1.7 cf70540.03]
JDK 1.4.2 cxia321420-20040626
Host Operating System is Linux, version 2.4.21-9.EL

Problem Summary:
----------------
The issue is that the method sendError() in the
HttpServletResponse throws an exception if the method
getOutputStream() had previously been called, even if no output
was written to the OutputStream.  The servlet container
restricts the use of the  methods
HttpServletResponse.getOutputStream() and getWriter() to ensure
that each method is called no more than once, and that either
the Writer or the OutputStream are used exclusively.  However,
sendError() appears to be using the getWriter() internally, so
if the application had already accessed the OutputStream, it
fails.
In the J2EE API docs for ServletResponse (which is a parent
interface for HttpServletResponse), both the getWriter method
and getOutputStream method will throw an IllegalStateException
if both of them are called.

The following simple JSP will demonstrate the problem:
   <%@ page buffer="64kb" %>
   <%
   java.io.OutputStream stream = response.getOutputStream();
   response.sendError(404);
   %>
Local fix Problem summary
****************************************************************
* USERS AFFECTED: WebSphere Application Server users of        *
*                 servlets that obtain an OutputStream before  *
*                 calling sendError() and do not have an       *
*                 error page defined.                          *
****************************************************************
* PROBLEM DESCRIPTION: An IllegalStateException is thrown      *
*                      when a servlet obtains an OutputStream  *
*                      before calling sendError() and an error *
*                      page has not been defined.              *
****************************************************************
* RECOMMENDATION:                                              *
****************************************************************
The WebContainer attempts to obtain a PrintWriter when
sendError is called and the user has not defined an error
page. If the servlet has already obtained an OutputStream
before calling sendError, an IllegalStateException will be
thrown since it is illegal to obtain both a PrintWriter and
an OutputStream.
Problem conclusion
Code was modified to catch the IllegalStateException and
utilize the OutputStream in that case.

The fix for this APAR is currently targeted for inclusion
in fixpacks 5.02.18 and 5.1.1.11.
Please refer to the recommended updates page for delivery
information:

http://www.ibm.com/support/docview.wss?rs=180&uid=swg27004980
Temporary fix Comments
APAR information
APAR number PK23496
Reported component name WAS NETWRK DEPL
Reported component ID 5630A3601
Reported release 10I
Status CLOSED PER
PE NoPE
HIPER NoHIPER
Special Attention NoSpecatt
Submitted date 2006-04-17
Closed date 2006-04-27
Last modified date 2006-04-27

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

APAR is sysrouted TO one or more of the following:

Modules/Macros
ENGINE          

Publications Referenced

Fix information
Fixed component name WAS NETWRK DEPL
Fixed component ID 5630A3601

Applicable component levels
R003 PSY    UP
R00A PSY    UP
R00H PSY    UP
R00I PSY    UP
R00P PSY    UP
R00S PSY    UP
R00W PSY    UP
R103 PSY    UP
R10A PSY    UP
R10H PSY    UP
R10I PSY    UP
R10P PSY    UP
R10S PSY    UP
R10W PSY    UP


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > General
Operating system(s):
Software version: 10I
Software edition:
Reference #: PK23496
IBM Group: Software Group
Modified date: Apr 27, 2006