Boolean.valueOf() -> Boolean.parseBoolean()

This commit is contained in:
zzz
2021-03-20 12:27:46 -04:00
parent 838295c014
commit b55fbbf099
10 changed files with 17 additions and 17 deletions

View File

@@ -868,7 +868,7 @@ public class TunnelController implements Logging {
}
if (type.equals(TYPE_HTTP_SERVER) || type.equals(TYPE_STREAMR_SERVER)) {
String tgzip = _config.getProperty(PROP_TUN_GZIP);
if (tgzip == null || Boolean.valueOf(tgzip)) {
if (tgzip == null || Boolean.parseBoolean(tgzip)) {
// Web server will gzip
// If web server doesn't gzip, I2PTunnelHTTPServer will.
// Streaming will force gzip on first packet for header compression,
@@ -933,7 +933,7 @@ public class TunnelController implements Logging {
}
}
if (isClient(type) &&
(type.equals(TYPE_HTTP_CLIENT) || Boolean.valueOf(_config.getProperty(PROP_SHARED, "false")))) {
(type.equals(TYPE_HTTP_CLIENT) || Boolean.parseBoolean(_config.getProperty(PROP_SHARED)))) {
// migration: HTTP proxy and shared clients default to both
if (!_config.containsKey(OPT_ENCTYPE))
_config.setProperty(OPT_ENCTYPE, "4,0");

View File

@@ -29,7 +29,7 @@
curPage = 1;
}
/* Fetch and format a couple of regularly-used values */
boolean tunnelIsClient = Boolean.valueOf(request.getParameter("isClient"));
boolean tunnelIsClient = Boolean.parseBoolean(request.getParameter("isClient"));
String tunnelType = request.getParameter("type");
tunnelType = net.i2p.data.DataHelper.stripHTML(tunnelType);
/* Special case - don't display page 4 for server tunnels */

View File

@@ -42,10 +42,10 @@ public class JspC {
private static final String THREADS_VERSION_8 = "8.5.33";
private static final String THREADS_VERSION_9 = "9.0.11";
// if true, try to make web.xml reproducible
private static final boolean REPRODUCIBLE = Boolean.valueOf(System.getProperty("build.reproducible"));
private static final boolean REPRODUCIBLE = Boolean.parseBoolean(System.getProperty("build.reproducible"));
// if true, we must get the Tomcat version out of the jasper jar's manifest
private static final boolean SYSTEM_TOMCAT = Boolean.valueOf(System.getProperty("with-libtomcat8-java")) ||
Boolean.valueOf(System.getProperty("with-libtomcat9-java"));
private static final boolean SYSTEM_TOMCAT = Boolean.parseBoolean(System.getProperty("with-libtomcat8-java")) ||
Boolean.parseBoolean(System.getProperty("with-libtomcat9-java"));
// path to the jasper jar
private static final String JASPER_JAR = System.getProperty("jasper.jar");

View File

@@ -441,7 +441,7 @@ class PluginUpdateRunner extends UpdateRunner {
boolean wasRunning = false;
File destDir = new SecureDirectory(appDir, appName);
if (destDir.exists()) {
if (Boolean.valueOf(props.getProperty("install-only")).booleanValue()) {
if (Boolean.parseBoolean(props.getProperty("install-only"))) {
to.delete();
statusDone("<b>" + _t("Downloaded plugin is for new installs only, but the plugin is already installed", url) + "</b>");
return;
@@ -517,7 +517,7 @@ class PluginUpdateRunner extends UpdateRunner {
return;
}
// do we defer extraction and installation?
if (Boolean.valueOf(props.getProperty("router-restart-required")).booleanValue()) {
if (Boolean.parseBoolean(props.getProperty("router-restart-required"))) {
// Yup!
try {
if(!FileUtil.copy(to, (new SecureFile( new SecureFile(appDir.getCanonicalPath() +"/" + appName +"/"+ ZIP).getCanonicalPath())) , true, true)) {
@@ -548,7 +548,7 @@ class PluginUpdateRunner extends UpdateRunner {
}
update = true;
} else {
if (Boolean.valueOf(props.getProperty("update-only")).booleanValue()) {
if (Boolean.parseBoolean(props.getProperty("update-only"))) {
to.delete();
statusDone("<b>" + _t("Plugin is for upgrades only, but the plugin is not installed") + ". " + appName + ' ' + version + "</b>");
return;
@@ -569,7 +569,7 @@ class PluginUpdateRunner extends UpdateRunner {
_updated = true;
to.delete();
// install != update. Changing the user's settings like this is probabbly a bad idea.
if (Boolean.valueOf( props.getProperty("dont-start-at-install")).booleanValue()) {
if (Boolean.parseBoolean( props.getProperty("dont-start-at-install"))) {
statusDone("<b>" + _t("Plugin {0} installed", appName + ' ' + version) + "</b>");
if(!update) {
Properties pluginProps = PluginStarter.pluginProperties();

View File

@@ -389,7 +389,7 @@ public class ConfigServiceHandler extends FormHandler {
}
} else if (enable) {
// already set to true, GraphicsEnvironment initialized, can't change it now
if (Boolean.valueOf(System.getProperty("java.awt.headless"))) {
if (Boolean.parseBoolean(System.getProperty("java.awt.headless"))) {
addFormError(_t("Restart required to take effect"));
} else {
dtg = new net.i2p.desktopgui.Main(_context, mgr, null);

View File

@@ -106,7 +106,7 @@ public class HostCheckHandler extends GzipHandler
int httpsPort = _portMapper.getPort(PortMapper.SVC_HTTPS_CONSOLE);
if (httpsPort > 0 && httpRequest.getLocalPort() != httpsPort) {
String redir = _context.getProperty(PROP_REDIRECT);
if (Boolean.valueOf(redir) ||
if (Boolean.parseBoolean(redir) ||
(redir == null && "1".equals(httpRequest.getHeader("Upgrade-Insecure-Requests")))) {
sendRedirect(httpsPort, httpRequest, httpResponse);
baseRequest.setHandled(true);

View File

@@ -205,7 +205,7 @@ public class AddressBean
/** @since 0.9.26 */
public boolean isValidated() {
return Boolean.valueOf(getProp("v"));
return Boolean.parseBoolean(getProp("v"));
}
/** @since 0.8.7 */

View File

@@ -991,7 +991,7 @@ public abstract class Addresses {
*/
private static String getPrivacyStatus() {
String rv = useIPv6TempAddresses();
if (Boolean.valueOf(rv)) {
if (Boolean.parseBoolean(rv)) {
long pref = getLong("/proc/sys/net/ipv6/conf/all/temp_prefered_lft");
if (pref > 0)
rv += ", preferred lifetime " + DataHelper.formatDuration(pref * 1000);

View File

@@ -44,7 +44,7 @@ public abstract class SystemVersion {
private static final boolean _hasWrapper = System.getProperty("wrapper.version") != null;
private static final boolean _isLinuxService;
// found in Tanuki WrapperManager source so we don't need the WrapperManager class here
private static final boolean _isWindowsService = _isWin && _hasWrapper && Boolean.valueOf(System.getProperty("wrapper.service"));
private static final boolean _isWindowsService = _isWin && _hasWrapper && Boolean.parseBoolean(System.getProperty("wrapper.service"));
private static final boolean _isService;
private static final boolean _isSlow;

View File

@@ -143,7 +143,7 @@ public class TransportManager implements TransportEventListener {
System.out.println(msg);
_log.logAlways(Log.WARN, msg);
rv = true;
} else if (!SystemVersion.isMac() && Boolean.valueOf(System.getProperty(PROP_JAVA_PROXY2))) {
} else if (!SystemVersion.isMac() && Boolean.parseBoolean(System.getProperty(PROP_JAVA_PROXY2))) {
try {
// Use ProxySelector to see if we would be proxied
// using a dummy address.
@@ -313,7 +313,7 @@ public class TransportManager implements TransportEventListener {
Set<String> ipset = Addresses.getAddresses(_context.getBooleanProperty("i2np.allowLocal"), false, true);
String lastv4 = _context.getProperty(UDPTransport.PROP_IP);
String lastv6 = _context.getProperty(UDPTransport.PROP_IPV6);
boolean preferTemp = Boolean.valueOf(Addresses.useIPv6TempAddresses());
boolean preferTemp = Boolean.parseBoolean(Addresses.useIPv6TempAddresses());
//
// Avoid IPv6 temporary addresses if we have a non-temporary one,
// unless the kernel prefers them