forked from I2P_Developers/i2p.i2p
better error messages, fix NPE, comment out template handling
This commit is contained in:
@@ -8,17 +8,21 @@
|
||||
*/
|
||||
|
||||
boolean rendered = false;
|
||||
/**** unused
|
||||
String templateFile = request.getParameter("template");
|
||||
if (templateFile != null) {
|
||||
java.io.OutputStream cout = response.getOutputStream();
|
||||
response.setContentType("image/png");
|
||||
rendered = net.i2p.router.web.StatSummarizer.instance().renderPng(cout, templateFile);
|
||||
}
|
||||
****/
|
||||
net.i2p.stat.Rate rate = null;
|
||||
String stat = request.getParameter("stat");
|
||||
String period = request.getParameter("period");
|
||||
boolean fakeBw = (stat != null && ("bw.combined".equals(stat)));
|
||||
net.i2p.stat.RateStat rs = net.i2p.I2PAppContext.getGlobalContext().statManager().getRate(stat);
|
||||
net.i2p.stat.RateStat rs = null;
|
||||
if (stat != null)
|
||||
rs = net.i2p.I2PAppContext.getGlobalContext().statManager().getRate(stat);
|
||||
if ( !rendered && ((rs != null) || fakeBw) ) {
|
||||
long per = -1;
|
||||
try {
|
||||
@@ -71,6 +75,9 @@ if ( !rendered && ((rs != null) || fakeBw) ) {
|
||||
* a huge load for a page full of graphs if there's a problem
|
||||
*/
|
||||
if (!rendered) {
|
||||
response.sendError(403, "That stat is not available");
|
||||
if (stat != null)
|
||||
response.sendError(403, "The stat " + stat + " is not available, it must be enabled for graphing on the stats configuration page.");
|
||||
else
|
||||
response.sendError(403, "No stat specified");
|
||||
}
|
||||
%>
|
Reference in New Issue
Block a user