https://bz.apache.org/bugzilla/show_bug.cgi?id=63350
Bug ID: 63350
Summary: JSP out.print() does not rethrow IOException
Product: Tomcat 9
Version: 9.0.19
Hardware: PC
OS: Mac OS X 10.1
Status: NEW
Severity: normal
Priority: P2
Component: Jasper
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: -----
Hi,
The out.print() does not rethrow IOException back to the caller JSP. While the
PrintWriter APIs do not throw any IOException, the JSPWriter (which is the type
for the implicit "out") should throw the IOException.
Simple JSP to recreate the issue:
<%
System.out.println("JSP start");
try {
for (int i=0 ; i<43490 ; i++) {
out.print("xyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxyxy");
}
out.print("END_OF_DATA");
}
catch(java.io.IOException e) {
System.out.println("caught a IOException !!!");
e.printStackTrace(System.out);
throw e;
}
System.out.println("JSP end");
%>
While request to the JSP, immediately cancel the connection (by ctrl-C). That
will cause a broken pipe connection and result in the IOException.
The JSPWriterImpl's "out" is back by the ServletResponse.getWriter() which is
the PrintWriter.
private void initOut() throws IOException {
if (out == null) {
out = response.getWriter();
}
}
So I think this PrintWriter has swallowed the IOException.
Thanks,
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]