forked from I2P_Developers/i2p.i2p
Console: Hide services sidebar section if empty
Use Exception.getLocalizedMessage() everywhere HomeHelper javadoc
This commit is contained in:
@ -269,7 +269,7 @@ public class ConfigServiceHandler extends FormHandler {
|
||||
try {
|
||||
WrapperManager.requestThreadDump();
|
||||
} catch (Throwable t) {
|
||||
addFormError("Warning: unable to contact the service manager - " + t.getMessage());
|
||||
addFormError("Warning: unable to contact the service manager - " + t.getLocalizedMessage());
|
||||
}
|
||||
File wlog = wrapperLogFile(_context);
|
||||
addFormNotice(_t("Threads dumped to {0}", wlog.getAbsolutePath()));
|
||||
@ -327,7 +327,7 @@ public class ConfigServiceHandler extends FormHandler {
|
||||
Runtime.getRuntime().exec("install_i2p_service_winnt.bat");
|
||||
addFormNotice(_t("Service installed"));
|
||||
} catch (IOException ioe) {
|
||||
addFormError(_t("Warning: unable to install the service") + " - " + ioe.getMessage());
|
||||
addFormError(_t("Warning: unable to install the service") + " - " + ioe.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -336,7 +336,7 @@ public class ConfigServiceHandler extends FormHandler {
|
||||
Runtime.getRuntime().exec("uninstall_i2p_service_winnt.bat");
|
||||
addFormNotice(_t("Service removed"));
|
||||
} catch (IOException ioe) {
|
||||
addFormError(_t("Warning: unable to remove the service") + " - " + ioe.getMessage());
|
||||
addFormError(_t("Warning: unable to remove the service") + " - " + ioe.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ class SummaryRenderer {
|
||||
ImageIO.write(img, "png", ios);
|
||||
} catch (RrdException re) {
|
||||
//_log.error("Error rendering " + filename, re);
|
||||
throw new IOException("Error plotting: " + re.getMessage());
|
||||
throw new IOException("Error plotting: " + re.getLocalizedMessage());
|
||||
} catch (IOException ioe) {
|
||||
//_log.error("Error rendering " + filename, ioe);
|
||||
throw ioe;
|
||||
@ -307,7 +307,7 @@ class SummaryRenderer {
|
||||
// ); // + ", data written to " + t.getAbsolutePath());
|
||||
} catch (RrdException re) {
|
||||
_log.error("Error rendering", re);
|
||||
throw new IOException("Error plotting: " + re.getMessage());
|
||||
throw new IOException("Error plotting: " + re.getLocalizedMessage());
|
||||
} catch (IOException ioe) {
|
||||
// typically org.mortbay.jetty.EofException extends java.io.EOFException
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
@ -315,7 +315,7 @@ class SummaryRenderer {
|
||||
throw ioe;
|
||||
} catch (OutOfMemoryError oom) {
|
||||
_log.error("Error rendering", oom);
|
||||
throw new IOException("Error plotting: " + oom.getMessage());
|
||||
throw new IOException("Error plotting: " + oom.getLocalizedMessage());
|
||||
} finally {
|
||||
// this does not close the underlying stream
|
||||
if (ios != null) try {ios.close();} catch (IOException ioe) {}
|
||||
|
@ -501,7 +501,7 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
if (status != null && status.length() > 0)
|
||||
addFormNoticeNoEscape(status);
|
||||
} catch (IOException ioe) {
|
||||
addFormError(_t("Install from file failed") + " - " + ioe.getMessage());
|
||||
addFormError(_t("Install from file failed") + " - " + ioe.getLocalizedMessage());
|
||||
} finally {
|
||||
// it's really a ByteArrayInputStream but we'll play along...
|
||||
if (in != null)
|
||||
|
@ -163,7 +163,7 @@ public class ConfigKeyringHandler extends FormHandler {
|
||||
addFormNotice(_t("Send key to server opererator.") + ' ' + pk.toPublic().toBase64());
|
||||
}
|
||||
} catch (IllegalArgumentException iae) {
|
||||
addFormError(_t("Invalid destination") + ": " + iae.getMessage());
|
||||
addFormError(_t("Invalid destination") + ": " + iae.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ public class ConfigReseedHandler extends FormHandler {
|
||||
}
|
||||
}
|
||||
} catch (IllegalArgumentException iae) {
|
||||
addFormError(_t("Bad URL {0}", val) + " - " + iae.getMessage());
|
||||
addFormError(_t("Bad URL {0}", val) + " - " + iae.getLocalizedMessage());
|
||||
}
|
||||
} else if (_action.equals(_t("Reseed from file"))) {
|
||||
// inline
|
||||
|
@ -44,6 +44,7 @@ public class HomeHelper extends HelperBase {
|
||||
_x("Addressbook") + S + _x("Manage your I2P hosts file here (I2P domain name resolution)") + S + "/dns" + S + I + "book_addresses.png" + S +
|
||||
"";
|
||||
|
||||
/** @since 0.9.44 */
|
||||
static final String DEFAULT_CONFIG =
|
||||
_x("Configure Homepage") + S + _x("Configure the contents of this page") + S + "/confighome" + S + I + "info/home.png" + S +
|
||||
_x("Configure Bandwidth") + S + _x("I2P Bandwidth Configuration") + S + "/config" + S + I + "info/bandwidth.png" + S +
|
||||
@ -92,6 +93,7 @@ public class HomeHelper extends HelperBase {
|
||||
"";
|
||||
|
||||
// No commas allowed in text strings!
|
||||
/** @since 0.9.44 */
|
||||
static final String DEFAULT_MONITORING =
|
||||
_x("Logs") + S + _x("View the logs") + S + "/logs" + S + I + "billiard_marker.png" + S +
|
||||
_x("Graphs") + S + _x("Visualize information about the router") + S + "/graphs" + S + I + "chart_line.png" + S +
|
||||
@ -113,10 +115,12 @@ public class HomeHelper extends HelperBase {
|
||||
return homeTable(PROP_SERVICES, DEFAULT_SERVICES, plugins);
|
||||
}
|
||||
|
||||
/** @since 0.9.44 */
|
||||
public String getConfig(){
|
||||
return homeTable(PROP_CONFIG, DEFAULT_CONFIG, null);
|
||||
}
|
||||
|
||||
/** @since 0.9.44 */
|
||||
public String getMonitoring(){
|
||||
return homeTable(PROP_MONITORING, DEFAULT_MONITORING, null);
|
||||
}
|
||||
@ -129,10 +133,12 @@ public class HomeHelper extends HelperBase {
|
||||
return configTable(PROP_SERVICES, DEFAULT_SERVICES);
|
||||
}
|
||||
|
||||
/** @since 0.9.44 */
|
||||
public String getConfigConfig() {
|
||||
return configTable(PROP_CONFIG, DEFAULT_CONFIG);
|
||||
}
|
||||
|
||||
/** @since 0.9.44 */
|
||||
public String getConfigMonitoring() {
|
||||
return configTable(PROP_MONITORING, DEFAULT_MONITORING);
|
||||
}
|
||||
|
@ -221,14 +221,6 @@ class SummaryBarRenderer {
|
||||
}
|
||||
|
||||
public String renderI2PServicesHTML() {
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/configclients\" target=\"_top\" title=\"")
|
||||
.append(_t("Configure startup of clients and webapps (services); manually start dormant services"))
|
||||
.append("\">")
|
||||
.append(_t("I2P Services"))
|
||||
.append("</a></h3>\n" +
|
||||
"<hr class=\"b\"><table id=\"sb_services\">");
|
||||
|
||||
// Store all items in map so they are sorted by translated name, add the plugins, then output
|
||||
Map<String, String> svcs = new TreeMap<String, String>(Collator.getInstance());
|
||||
StringBuilder rbuf = new StringBuilder(128);
|
||||
@ -286,11 +278,22 @@ class SummaryBarRenderer {
|
||||
Map<String, String> apps = NavHelper.getClientAppLinks();
|
||||
if (apps != null)
|
||||
svcs.putAll(apps);
|
||||
for (String row : svcs.values()) {
|
||||
buf.append(row);
|
||||
if (!svcs.isEmpty()) {
|
||||
StringBuilder buf = new StringBuilder(128 * svcs.size());
|
||||
buf.append("<h3><a href=\"/configclients\" target=\"_top\" title=\"")
|
||||
.append(_t("Configure startup of clients and webapps (services); manually start dormant services"))
|
||||
.append("\">")
|
||||
.append(_t("I2P Services"))
|
||||
.append("</a></h3>\n" +
|
||||
"<hr class=\"b\"><table id=\"sb_services\">");
|
||||
for (String row : svcs.values()) {
|
||||
buf.append(row);
|
||||
}
|
||||
buf.append("</table>\n");
|
||||
return buf.toString();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
buf.append("</table>\n");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user