APAR status
Closed as program error.
Error description
This customer is getting NullPointerException in BufferedServlet
OutputStream when running his servlet that generates plain text
using the following code:
.
URL url = new URL(printUrl);
URLConnection con = url.openConnection();
// Don't use a cached version of URL connection.
con.setUseCaches(false);
con.setDefaultUseCaches(false);
InputStreamReader is = new InputStreamReader(con.getInputStream(
"UTF8");
char[] readChars = new char[2048];
CharArrayWriter os = new CharArrayWriter(64000);
for (int readLen = is.read(readChars); readLen >= 0; readLen =
is.read(readChars)) {
if (readLen > 0) {
os.write(readChars, 0, readLen);
}
}
is.close();
oReturn = os.toCharArray();
os.close();
.
.
When running this code he gets the following exception:
.
Trace: 2004/03/08 11:41:13.252 01 t=9E0B58 c=123A99.1 key=P8 (13
FunctionName: com.ibm.ws.webcontainer.srt.WebGroup
SourceId: com.ibm.ws.webcontainer.srt.WebGroup
Category: INFO
ExtendedMessage: SRVE0181I: [SFS] [/SFS] [Servlet.LOG]: Barcod
ePartRDBServlet: com.fedex.lh.mavis.sfs.controller.BarcodePar
tRDB: java.lang.NullPointerException
at com.ibm.ws.webcontainer.srt.BufferedServletOutputStre
am.print(BufferedServletOutputStream.java(Compiled Code
))
at javax.servlet.ServletOutputStream.println(ServletOutp
utStream.java(Inlined Compiled Code))
at com.fedex.lh.mavis.sfs.controller.BarcodeLabel.proces
sRequest(BarcodeLabel.java(Compiled Code))
at com.fedex.lh.mavis.sfs.controller.BarcodeLabel.doGet(
BarcodeLabel.java(Compiled Code))
at javax.servlet.http.HttpServlet.service(HttpServlet.ja
va(Compiled Code))
at javax.servlet.http.HttpServlet.service(HttpServlet.ja
va(Compiled Code))
at com.ibm.ws.webcontainer.servlet.StrictServletInstance
.doService(StrictServletInstance.java(Compiled Code)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServle
t._service(StrictLifecycleServlet.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.IdleServletState.serv
ice(StrictLifecycleServlet.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServle
t.service(StrictLifecycleServlet.java(Inlined Compiled
Code))
at com.ibm.ws.webcontainer.servlet.ServletInstance.servi
ce(ServletInstance.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.ValidServletReferenc
eState.dispatch(ValidServletReferenceState.java(Compile
d Code))
at com.ibm.ws.webcontainer.servlet.ServletInstanceRefere
nce.dispatch(ServletInstanceReference.java(Inlined Comp
iled Code))
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatche
r.handleWebAppDispatch(WebAppRequestDispatcher.java(Com
piled Code))
.
.
.
Local fix Problem summary
****************************************************************
* USERS AFFECTED: WebSphere Application server users of *
* BufferedServletOutputStream *
****************************************************************
* PROBLEM DESCRIPTION: When print(null) is called on *
* BufferedServletOutputStream, a *
* NullPointerException will be thrown. *
****************************************************************
* RECOMMENDATION: print(null) is abnormal, it should be *
* avoided. *
****************************************************************
When print(null) is called, the method checks the length of the
parameter and this causes a NullPointerException.
Problem conclusion
Code has been changed to check null before using parameters in
the print method to avoid the NullPointerException.
Temporary fix Comments
APAR information |
APAR number |
PQ88872 |
Reported component name |
WAS BASE 5.0 |
Reported component ID |
5630A3600 |
Reported release |
00W |
Status |
CLOSED PER |
PE |
NoPE |
HIPER |
NoHIPER |
Special Attention |
NoSpecatt |
Submitted date |
2004-05-14 |
Closed date |
2004-06-07 |
Last modified date |
2004-08-06 |
APAR is sysrouted FROM one or more of the following:
PQ88867
APAR is sysrouted TO one or more of the following:
Modules/Macros
Publications Referenced
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 |
|