forked from I2P_Developers/i2p.i2p
* Console: Try to prevent cascaded IllegalStateExceptions in .jsp code;
add logging for original error
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
* flags.jsp?c=de => icons/flags/de.png
|
||||
* with headers set so the browser caches.
|
||||
*/
|
||||
boolean rendered = false;
|
||||
String c = request.getParameter("c");
|
||||
if (c != null && c.length() > 0) {
|
||||
java.io.OutputStream cout = response.getOutputStream();
|
||||
@@ -38,17 +37,23 @@ if (c != null && c.length() > 0) {
|
||||
response.setContentType("image/png");
|
||||
try {
|
||||
net.i2p.util.FileUtil.readFile(file, base, cout);
|
||||
rendered = true;
|
||||
} catch (java.io.IOException ioe) {}
|
||||
if (rendered)
|
||||
cout.close();
|
||||
} catch (java.io.IOException ioe) {
|
||||
// prevent 'Committed' IllegalStateException from Jetty
|
||||
if (!response.isCommitted()) {
|
||||
response.sendError(403, ioe.toString());
|
||||
} else {
|
||||
net.i2p.I2PAppContext.getGlobalContext().logManager().getLog(getClass()).error("Error serving flags/" + c + ".png", ioe);
|
||||
// Jetty doesn't log this
|
||||
throw ioe;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Send a 403 instead of a 404, because the server sends error.jsp
|
||||
* for 404 errors, complete with the summary bar, which would be
|
||||
* a huge load for a page full of flags if the user didn't have the
|
||||
* flags directory for some reason.
|
||||
*/
|
||||
response.sendError(403, "No flag specified");
|
||||
}
|
||||
/*
|
||||
* Send a 403 instead of a 404, because the server sends error.jsp
|
||||
* for 404 errors, complete with the summary bar, which would be
|
||||
* a huge load for a page full of flags if the user didn't have the
|
||||
* flags directory for some reason.
|
||||
*/
|
||||
if (!rendered)
|
||||
response.sendError(403, "Flag not found");
|
||||
%>
|
Reference in New Issue
Block a user