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

@ -604,7 +604,7 @@ public class TunnelConfig {
if (TunnelController.TYPE_HTTP_CLIENT.equals(_type))
_booleanOptions.add(I2PTunnelHTTPClient.PROP_SSL_SET);
for (String p : _booleanClientOpts)
config.setProperty(OPT + p, "" + _booleanOptions.contains(p));
config.setProperty(OPT + p, Boolean.toString(_booleanOptions.contains(p)));
for (String p : _otherClientOpts) {
if (_otherOptions.containsKey(p))
config.setProperty(OPT + p, _otherOptions.get(p));
@ -616,7 +616,7 @@ public class TunnelConfig {
// see TunnelController.setConfig()
_booleanOptions.add(TunnelController.PROP_LIMITS_SET);
for (String p : _booleanServerOpts)
config.setProperty(OPT + p, "" + _booleanOptions.contains(p));
config.setProperty(OPT + p, Boolean.toString(_booleanOptions.contains(p)));
for (String p : _otherServerOpts) {
if (_otherOptions.containsKey(p))
config.setProperty(OPT + p, _otherOptions.get(p));
@ -634,7 +634,7 @@ public class TunnelConfig {
if (TunnelController.TYPE_HTTP_CLIENT.equals(_type) || TunnelController.TYPE_CONNECT.equals(_type) ||
TunnelController.TYPE_SOCKS.equals(_type) ||TunnelController.TYPE_SOCKS_IRC.equals(_type)) {
for (String p : _booleanProxyOpts)
config.setProperty(OPT + p, "" + _booleanOptions.contains(p));
config.setProperty(OPT + p, Boolean.toString(_booleanOptions.contains(p)));
if (_proxyList != null)
config.setProperty(TunnelController.PROP_PROXIES, _proxyList);
}
@ -705,7 +705,7 @@ public class TunnelConfig {
if (TunnelController.TYPE_IRC_CLIENT.equals(_type)) {
boolean dcc = _booleanOptions.contains(I2PTunnelIRCClient.PROP_DCC);
config.setProperty(OPT + I2PTunnelIRCClient.PROP_DCC,
"" + dcc);
Boolean.toString(dcc));
// add some sane server options since they aren't in the GUI (yet)
if (dcc) {
config.setProperty(OPT + PROP_MAX_CONNS_MIN, "3");

View File

@ -61,7 +61,7 @@ public class EditBean extends IndexBean {
public String getTargetPort(int tunnel) {
int port = _helper.getTargetPort(tunnel);
return port > 0 ? "" + port : "";
return port > 0 ? Integer.toString(port) : "";
}
public String getPrivateKeyFile(int tunnel) {

View File

@ -169,8 +169,8 @@ public class I2PSocketEepGet extends EepGet {
// This currently duplicates what SocketTimeout is doing in EepGet,
// but when that's ripped out of EepGet to use setsotimeout, we'll need this.
Properties props = new Properties();
props.setProperty(I2PSocketOptions.PROP_CONNECT_TIMEOUT, "" + CONNECT_TIMEOUT);
props.setProperty(I2PSocketOptions.PROP_READ_TIMEOUT, "" + INACTIVITY_TIMEOUT);
props.setProperty(I2PSocketOptions.PROP_CONNECT_TIMEOUT, Integer.toString(CONNECT_TIMEOUT));
props.setProperty(I2PSocketOptions.PROP_READ_TIMEOUT, Integer.toString(INACTIVITY_TIMEOUT));
// This is important - even if the underlying socket doesn't have a connect delay,
// we want to set it for this connection, so the request headers will go out
// in the SYN packet, saving one RTT.

View File

@ -240,7 +240,7 @@ public class I2PSocketManagerFactory {
if (i2cpHost != null)
opts.setProperty(I2PClient.PROP_TCP_HOST, i2cpHost);
if (i2cpPort > 0)
opts.setProperty(I2PClient.PROP_TCP_PORT, "" + i2cpPort);
opts.setProperty(I2PClient.PROP_TCP_PORT, Integer.toString(i2cpPort));
I2PSession session = client.createSession(myPrivateKeyStream, opts);
if (connect)

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"));
}

View File

@ -433,7 +433,7 @@ public class AddressbookBean extends BaseBean
}
public String getBegin() {
return "" + getBeginInt();
return Integer.toString(getBeginInt());
}
/**
@ -455,7 +455,7 @@ public class AddressbookBean extends BaseBean
}
public String getEnd() {
return "" + getEndInt();
return Integer.toString(getEndInt());
}
/**

View File

@ -693,8 +693,8 @@ public class WebMail extends HttpServlet
boolean fixedPorts = Boolean.parseBoolean(Config.getProperty( CONFIG_PORTS_FIXED, "true" ));
if (fixedPorts) {
host = Config.getProperty( CONFIG_HOST, DEFAULT_HOST );
pop3Port = Config.getProperty( CONFIG_PORTS_POP3, "" + DEFAULT_POP3PORT );
smtpPort = Config.getProperty( CONFIG_PORTS_SMTP, "" + DEFAULT_SMTPPORT );
pop3Port = Config.getProperty(CONFIG_PORTS_POP3, Integer.toString(DEFAULT_POP3PORT));
smtpPort = Config.getProperty(CONFIG_PORTS_SMTP, Integer.toString(DEFAULT_SMTPPORT));
}
boolean doContinue = true;
@ -3069,8 +3069,8 @@ public class WebMail extends HttpServlet
{
boolean fixed = Boolean.parseBoolean(Config.getProperty( CONFIG_PORTS_FIXED, "true" ));
String host = Config.getProperty(CONFIG_HOST, DEFAULT_HOST);
String pop3 = Config.getProperty( CONFIG_PORTS_POP3, "" + DEFAULT_POP3PORT );
String smtp = Config.getProperty( CONFIG_PORTS_SMTP, "" + DEFAULT_SMTPPORT );
String pop3 = Config.getProperty(CONFIG_PORTS_POP3, Integer.toString(DEFAULT_POP3PORT));
String smtp = Config.getProperty(CONFIG_PORTS_SMTP, Integer.toString(DEFAULT_SMTPPORT));
out.println( "<div id=\"dologin\"><h1>" + _t("Email Login") + "</h1><table cellspacing=\"3\" cellpadding=\"5\">\n" +
// current postman hq length limits 16/12, new postman version 32/32

View File

@ -387,8 +387,9 @@ class I2CPMessageProducer {
Properties newprops = new Properties();
newprops.putAll(props);
props = newprops;
props.setProperty("inbound.quantity", "" + tunnels);
props.setProperty("outbound.quantity", "" + tunnels);
String stunnels = Integer.toString(tunnels);
props.setProperty("inbound.quantity", stunnels);
props.setProperty("outbound.quantity", stunnels);
props.setProperty("inbound.backupQuantity", "0");
props.setProperty("outbound.backupQuantity", "0");
}

View File

@ -557,7 +557,7 @@ public class EepGet {
System.out.println("** " + new Date());
System.out.println("** Attempt " + currentAttempt + " of " + url + " failed");
System.out.println("** Transfered " + bytesTransferred
+ " with " + (bytesRemaining < 0 ? "unknown" : ""+bytesRemaining) + " remaining");
+ " with " + (bytesRemaining < 0 ? "unknown" : Long.toString(bytesRemaining)) + " remaining");
System.out.println("** " + cause.getMessage());
_previousWritten += _written;
_written = 0;
@ -566,7 +566,7 @@ public class EepGet {
System.out.println("== " + new Date());
System.out.println("== Transfer of " + url + " failed after " + currentAttempt + " attempts");
System.out.println("== Transfer size: " + bytesTransferred + " with "
+ (bytesRemaining < 0 ? "unknown" : ""+bytesRemaining) + " remaining");
+ (bytesRemaining < 0 ? "unknown" : Long.toString(bytesRemaining)) + " remaining");
long timeToSend = _context.clock().now() - _startedOn;
System.out.println("== Transfer time: " + DataHelper.formatDuration(timeToSend));
double kbps = (timeToSend > 0 ? (1000.0d*(bytesTransferred)/(timeToSend*1024.0d)) : 0);

View File

@ -152,7 +152,7 @@ public class RouterContext extends I2PAppContext {
long maxMemory = SystemVersion.getMaxMemory();
long maxBuffs = (SystemVersion.isAndroid() || SystemVersion.isARM()) ? 4 : 8;
long buffs = Math.min(maxBuffs, Math.max(2, maxMemory / (21 * 1024 * 1024)));
envProps.setProperty("prng.buffers", "" + buffs);
envProps.setProperty("prng.buffers", Long.toString(buffs));
}
return envProps;
}

View File

@ -337,16 +337,16 @@ public class TunnelPoolSettings {
*/
public void writeToProperties(String prefix, Properties props) {
if (props == null) return;
props.setProperty(prefix + PROP_ALLOW_ZERO_HOP, ""+_allowZeroHop);
props.setProperty(prefix + PROP_BACKUP_QUANTITY, ""+_backupQuantity);
props.setProperty(prefix + PROP_ALLOW_ZERO_HOP, Boolean.toString(_allowZeroHop));
props.setProperty(prefix + PROP_BACKUP_QUANTITY, Integer.toString(_backupQuantity));
//props.setProperty(prefix + PROP_DURATION, ""+_duration);
props.setProperty(prefix + PROP_LENGTH, ""+_length);
props.setProperty(prefix + PROP_LENGTH_VARIANCE, ""+_lengthVariance);
props.setProperty(prefix + PROP_LENGTH, Integer.toString(_length));
props.setProperty(prefix + PROP_LENGTH_VARIANCE, Integer.toString(_lengthVariance));
if (_destinationNickname != null)
props.setProperty(prefix + PROP_NICKNAME, ""+_destinationNickname);
props.setProperty(prefix + PROP_QUANTITY, ""+_quantity);
props.setProperty(prefix + PROP_NICKNAME, _destinationNickname);
props.setProperty(prefix + PROP_QUANTITY, Integer.toString(_quantity));
// props.setProperty(prefix + PROP_REBUILD_PERIOD, ""+_rebuildPeriod);
props.setProperty(prefix + PROP_IP_RESTRICTION, ""+_IPRestriction);
props.setProperty(prefix + PROP_IP_RESTRICTION, Integer.toString(_IPRestriction));
if (!_isInbound)
props.setProperty(prefix + PROP_PRIORITY, Integer.toString(_priority));
for (Map.Entry<Object, Object> e : _unknownOptions.entrySet()) {

View File

@ -176,8 +176,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
private static final String PROP_DEFAULT_MTU = "i2np.udp.mtu";
private static final String PROP_ADVANCED = "routerconsole.advanced";
private static final String CAP_TESTING = "" + UDPAddress.CAPACITY_TESTING;
private static final String CAP_TESTING_INTRO = "" + UDPAddress.CAPACITY_TESTING + UDPAddress.CAPACITY_INTRODUCER;
private static final String CAP_TESTING = Character.toString(UDPAddress.CAPACITY_TESTING);
private static final String CAP_TESTING_INTRO = CAP_TESTING + UDPAddress.CAPACITY_INTRODUCER;
/** how many relays offered to us will we use at a time? */
public static final int PUBLIC_RELAY_COUNT = 3;