conversion cleanup

This commit is contained in:
zzz
2018-08-25 14:29:32 +00:00
parent c3881a811b
commit 57ddc8ea4f
20 changed files with 61 additions and 59 deletions

View File

@ -130,7 +130,7 @@ public class CSSHelper extends HelperBase {
public void setRefresh(String r) {
try {
if (Integer.parseInt(r) < MIN_REFRESH)
r = "" + MIN_REFRESH;
r = Integer.toString(MIN_REFRESH);
_context.router().saveConfig(PROP_REFRESH, r);
} catch (RuntimeException e) {
}
@ -141,9 +141,9 @@ public class CSSHelper extends HelperBase {
String r = _context.getProperty(PROP_REFRESH, DEFAULT_REFRESH);
try {
if (Integer.parseInt(r) < MIN_REFRESH)
r = "" + MIN_REFRESH;
r = Integer.toString(MIN_REFRESH);
} catch (RuntimeException e) {
r = "" + MIN_REFRESH;
r = Integer.toString(MIN_REFRESH);
}
return r;
}

View File

@ -55,7 +55,7 @@ public class ConfigUpdateHandler extends FormHandler {
public static final String DEFAULT_PROXY_HOST = "127.0.0.1";
public static final String PROP_PROXY_PORT = "router.updateProxyPort";
public static final int DEFAULT_PROXY_PORT_INT = 4444;
public static final String DEFAULT_PROXY_PORT = "" + DEFAULT_PROXY_PORT_INT;
public static final String DEFAULT_PROXY_PORT = Integer.toString(DEFAULT_PROXY_PORT_INT);
/** default false */
public static final String PROP_UPDATE_UNSIGNED = "router.updateUnsigned";
/** default false - use for distros */
@ -251,7 +251,7 @@ public class ConfigUpdateHandler extends FormHandler {
long oldFreq = DEFAULT_REFRESH_FREQ;
try { oldFreq = Long.parseLong(oldFreqStr); } catch (NumberFormatException nfe) {}
if (_refreshFrequency != oldFreq) {
changes.put(PROP_REFRESH_FREQUENCY, ""+_refreshFrequency);
changes.put(PROP_REFRESH_FREQUENCY, Long.toString(_refreshFrequency));
addFormNoticeNoEscape(_t("Updating refresh frequency to {0}",
_refreshFrequency <= 0 ? _t("Never") : DataHelper.formatDuration2(_refreshFrequency)));
}

View File

@ -361,7 +361,7 @@ public class ConfigClientsHandler extends FormHandler {
String app = name.substring(RouterConsoleRunner.PREFIX.length(), name.lastIndexOf(RouterConsoleRunner.ENABLED));
Object val = _settings.get(app + ".enabled");
if (! RouterConsoleRunner.ROUTERCONSOLE.equals(app))
props.setProperty(name, "" + (val != null));
props.setProperty(name, Boolean.toString(val != null));
}
RouterConsoleRunner.storeWebAppProperties(_context, props);
addFormNotice(_t("WebApp configuration saved."));
@ -375,7 +375,7 @@ public class ConfigClientsHandler extends FormHandler {
continue;
String app = name.substring(PluginStarter.PREFIX.length(), name.lastIndexOf(PluginStarter.ENABLED));
Object val = _settings.get(app + ".enabled");
props.setProperty(name, "" + (val != null));
props.setProperty(name, Boolean.toString(val != null));
}
PluginStarter.storePluginProperties(props);
addFormNotice(_t("Plugin configuration saved."));

View File

@ -148,7 +148,8 @@ public class ConfigClientsHelper extends HelperBase {
showStart = clientApp == null;
showStop = clientApp != null && clientApp.getState() == ClientAppState.RUNNING;
}
renderForm(buf, ""+cur, ca.clientName,
String scur = Integer.toString(cur);
renderForm(buf, scur, ca.clientName,
// urlify, enabled
false, !ca.disabled,
// read only, preventDisable
@ -158,7 +159,7 @@ public class ConfigClientsHelper extends HelperBase {
// description
DataHelper.escapeHTML(ca.className + ((ca.args != null) ? " " + ca.args : "")),
// edit
allowEdit && (""+cur).equals(_edit),
allowEdit && scur.equals(_edit),
// show edit button, show update button
// Don't allow edit if it's running, or else we would lose the "handle" to the ClientApp to stop it.
allowEdit && !showStop, false,
@ -169,7 +170,7 @@ public class ConfigClientsHelper extends HelperBase {
}
if (allowEdit && "new".equals(_edit))
renderForm(buf, "" + clients.size(), "", false, false, false, false, "", true, false, false, false, false, false);
renderForm(buf, Integer.toString(clients.size()), "", false, false, false, false, "", true, false, false, false, false, false);
buf.append("</table>\n");
return buf.toString();
}

View File

@ -27,7 +27,7 @@ public class ConfigHomeHandler extends FormHandler {
boolean old = _context.getBooleanProperty(HomeHelper.PROP_OLDHOME);
boolean nnew = getJettyString("oldHome") != null;
if (old != nnew) {
_context.router().saveConfig(HomeHelper.PROP_OLDHOME, "" + nnew);
_context.router().saveConfig(HomeHelper.PROP_OLDHOME, Boolean.toString(nnew));
addFormNotice(_t("Home page changed"));
}
} else if (adding || deleting || restoring) {

View File

@ -282,7 +282,7 @@ public class ConfigNetHandler extends FormHandler {
}
if (valid) {
changes.put(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_IP, _ntcpAutoIP);
changes.put(TransportManager.PROP_ENABLE_NTCP, "" + !"disabled".equals(_ntcpAutoIP));
changes.put(TransportManager.PROP_ENABLE_NTCP, Boolean.toString(!"disabled".equals(_ntcpAutoIP)));
restartRequired = true;
}
}
@ -304,7 +304,7 @@ public class ConfigNetHandler extends FormHandler {
removes.add(ConfigNetHelper.PROP_I2NP_NTCP_PORT);
addFormNotice(_t("Updating inbound TCP port to auto"));
}
changes.put(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_PORT, "" + _ntcpAutoPort);
changes.put(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_PORT, Boolean.toString(_ntcpAutoPort));
restartRequired = true;
}
@ -339,15 +339,15 @@ public class ConfigNetHandler extends FormHandler {
// If hidden mode value changes, restart is required
switchRequired = _hiddenMode != _context.router().isHidden();
if (switchRequired) {
changes.put(PROP_HIDDEN, "" + _hiddenMode);
changes.put(PROP_HIDDEN, Boolean.toString(_hiddenMode));
if (_hiddenMode)
addFormError(_t("Gracefully restarting into Hidden Router Mode"));
else
addFormError(_t("Gracefully restarting to exit Hidden Router Mode"));
}
changes.put(Router.PROP_REBUILD_KEYS, "" + switchRequired);
changes.put(Router.PROP_DYNAMIC_KEYS, "" + _dynamicKeys);
changes.put(Router.PROP_REBUILD_KEYS, Boolean.toString(switchRequired));
changes.put(Router.PROP_DYNAMIC_KEYS, Boolean.toString(_dynamicKeys));
if (_context.getBooleanPropertyDefaultTrue(TransportManager.PROP_ENABLE_UPNP) !=
_upnp) {
@ -358,7 +358,7 @@ public class ConfigNetHandler extends FormHandler {
addFormNotice(_t("Disabling UPnP"));
addFormNotice(_t("Restart required to take effect"));
}
changes.put(TransportManager.PROP_ENABLE_UPNP, "" + _upnp);
changes.put(TransportManager.PROP_ENABLE_UPNP, Boolean.toString(_upnp));
if (Boolean.parseBoolean(_context.getProperty(UDPTransport.PROP_LAPTOP_MODE)) !=
_laptop) {
@ -368,7 +368,7 @@ public class ConfigNetHandler extends FormHandler {
else
addFormNotice(_t("Disabling laptop mode"));
}
changes.put(UDPTransport.PROP_LAPTOP_MODE, "" + _laptop);
changes.put(UDPTransport.PROP_LAPTOP_MODE, Boolean.toString(_laptop));
if (Boolean.parseBoolean(_context.getProperty(TransportUtil.PROP_IPV4_FIREWALLED)) !=
_ipv4Firewalled) {
@ -378,7 +378,7 @@ public class ConfigNetHandler extends FormHandler {
addFormNotice(_t("Enabling inbound IPv4"));
restartRequired = true;
}
changes.put(TransportUtil.PROP_IPV4_FIREWALLED, "" + _ipv4Firewalled);
changes.put(TransportUtil.PROP_IPV4_FIREWALLED, Boolean.toString(_ipv4Firewalled));
if (Boolean.parseBoolean(_context.getProperty(TransportUtil.PROP_IPV6_FIREWALLED)) !=
_ipv6Firewalled) {
@ -388,7 +388,7 @@ public class ConfigNetHandler extends FormHandler {
addFormNotice(_t("Enabling inbound IPv6"));
restartRequired = true;
}
changes.put(TransportUtil.PROP_IPV6_FIREWALLED, "" + _ipv6Firewalled);
changes.put(TransportUtil.PROP_IPV6_FIREWALLED, Boolean.toString(_ipv6Firewalled));
if (_context.getBooleanPropertyDefaultTrue(TransportManager.PROP_ENABLE_UDP) !=
!_udpDisabled) {
@ -398,7 +398,7 @@ public class ConfigNetHandler extends FormHandler {
addFormNotice(_t("Enabling UDP"));
restartRequired = true;
}
changes.put(TransportManager.PROP_ENABLE_UDP, "" + (!_udpDisabled));
changes.put(TransportManager.PROP_ENABLE_UDP, Boolean.toString(!_udpDisabled));
if (_requireIntroductions) {
changes.put(UDPTransport.PROP_FORCE_INTRODUCERS, "true");

View File

@ -113,7 +113,7 @@ public class ConfigStatsHandler extends FormHandler {
boolean graphsChanged = !_graphs.equals(_context.getProperty("stat.summaries"));
changes.put("stat.summaries", _graphs);
boolean fullChanged = _context.getBooleanProperty(StatManager.PROP_STAT_FULL) != _isFull;
changes.put(StatManager.PROP_STAT_FULL, "" + _isFull);
changes.put(StatManager.PROP_STAT_FULL, Boolean.toString(_isFull));
_context.router().saveConfig(changes, null);
if (!_stats.isEmpty())
addFormNotice(_t("Stat filter and location updated successfully to") + ": " + stats.toString());

View File

@ -30,7 +30,7 @@ public class ConfigSummaryHandler extends FormHandler {
try {
int refreshInterval = Integer.parseInt(getJettyString("refreshInterval"));
if (refreshInterval >= CSSHelper.MIN_REFRESH) {
_context.router().saveConfig(CSSHelper.PROP_REFRESH, "" + refreshInterval);
_context.router().saveConfig(CSSHelper.PROP_REFRESH, Integer.toString(refreshInterval));
addFormNotice(_t("Refresh interval changed"));
} else
addFormError(_t("Refresh interval must be at least {0} seconds", CSSHelper.MIN_REFRESH));

View File

@ -477,13 +477,13 @@ public class GraphHelper extends FormHandler {
_graphHideLegend != _context.getProperty(PROP_LEGEND, DEFAULT_LEGEND) ||
_persistent != _context.getBooleanPropertyDefaultTrue(SummaryListener.PROP_PERSISTENT)) {
Map<String, String> changes = new HashMap<String, String>();
changes.put(PROP_X, "" + _width);
changes.put(PROP_Y, "" + _height);
changes.put(PROP_PERIODS, "" + _periodCount);
changes.put(PROP_REFRESH, "" + _refreshDelaySeconds);
changes.put(PROP_EVENTS, "" + _showEvents);
changes.put(PROP_LEGEND, "" + _graphHideLegend);
changes.put(SummaryListener.PROP_PERSISTENT, "" + _persistent);
changes.put(PROP_X, Integer.toString(_width));
changes.put(PROP_Y, Integer.toString(_height));
changes.put(PROP_PERIODS, Integer.toString(_periodCount));
changes.put(PROP_REFRESH, Integer.toString(_refreshDelaySeconds));
changes.put(PROP_EVENTS, Boolean.toString(_showEvents));
changes.put(PROP_LEGEND, Boolean.toString(_graphHideLegend));
changes.put(SummaryListener.PROP_PERSISTENT, Boolean.toString(_persistent));
_context.router().saveConfig(changes, null);
addFormNotice(_t("Graph settings saved"));
}