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

This commit is contained in:
zzz
2012-09-28 17:50:41 +00:00
parent 7c8ba61f03
commit fb5d0cd760
54 changed files with 107 additions and 108 deletions

View File

@ -218,7 +218,7 @@ public class ConfigClientsHelper extends HelperBase {
.append("<a href=\"").append(updateURL).append("\">").append(_("Update link")).append("</a><td>&nbsp;");
}
desc.append("</table>");
boolean enableStop = !Boolean.valueOf(appProps.getProperty("disableStop")).booleanValue();
boolean enableStop = !Boolean.parseBoolean(appProps.getProperty("disableStop"));
enableStop &= PluginStarter.isPluginRunning(app, _context);
boolean enableStart = !PluginStarter.isPluginRunning(app, _context);
renderForm(buf, app, app, false,

View File

@ -184,7 +184,7 @@ public class ConfigNetHandler extends FormHandler {
String oldNPort = _context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_PORT, "");
String oldAutoHost = _context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_IP, "true");
String sAutoPort = _context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_PORT, "true");
boolean oldAutoPort = Boolean.valueOf(sAutoPort).booleanValue();
boolean oldAutoPort = Boolean.parseBoolean(sAutoPort);
if (_ntcpHostname == null) _ntcpHostname = "";
if (_ntcpPort == null) _ntcpPort = "";
if (_ntcpAutoIP == null) _ntcpAutoIP = "true";
@ -265,7 +265,7 @@ public class ConfigNetHandler extends FormHandler {
changes.put(Router.PROP_DYNAMIC_KEYS, "" + _dynamicKeys);
if (Boolean.valueOf(_context.getProperty(TransportManager.PROP_ENABLE_UPNP)).booleanValue() !=
if (Boolean.parseBoolean(_context.getProperty(TransportManager.PROP_ENABLE_UPNP)) !=
_upnp) {
// This is minor, don't set restartRequired
if (_upnp)
@ -275,7 +275,7 @@ public class ConfigNetHandler extends FormHandler {
}
changes.put(TransportManager.PROP_ENABLE_UPNP, "" + _upnp);
if (Boolean.valueOf(_context.getProperty(UDPTransport.PROP_LAPTOP_MODE)).booleanValue() !=
if (Boolean.parseBoolean(_context.getProperty(UDPTransport.PROP_LAPTOP_MODE)) !=
_laptop) {
// This is minor, don't set restartRequired
if (_laptop)

View File

@ -74,15 +74,14 @@ public class ConfigUpdateHelper extends HelperBase {
public String getUpdateThroughProxy() {
String proxy = _context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY);
if (Boolean.valueOf(proxy).booleanValue())
if (Boolean.parseBoolean(proxy))
return "<input type=\"checkbox\" class=\"optbox\" value=\"true\" name=\"updateThroughProxy\" checked=\"checked\" >";
else
return "<input type=\"checkbox\" class=\"optbox\" value=\"true\" name=\"updateThroughProxy\" >";
}
public String getUpdateUnsigned() {
String foo = _context.getProperty(ConfigUpdateHandler.PROP_UPDATE_UNSIGNED);
if (Boolean.valueOf(foo).booleanValue())
if (_context.getBooleanProperty(ConfigUpdateHandler.PROP_UPDATE_UNSIGNED))
return "<input type=\"checkbox\" class=\"optbox\" value=\"true\" name=\"updateUnsigned\" checked=\"checked\" >";
else
return "<input type=\"checkbox\" class=\"optbox\" value=\"true\" name=\"updateUnsigned\" >";

View File

@ -16,7 +16,7 @@ public class ContentHelper extends HelperBase {
*/
public void setPage(String page) { _page = page; }
public void setStartAtBeginning(String moo) {
_startAtBeginning = Boolean.valueOf(""+moo).booleanValue();
_startAtBeginning = Boolean.parseBoolean(moo);
}
public void setLang(String l) {
/*****

View File

@ -172,7 +172,7 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener {
boolean dontInstall() {
File test = new File(_context.getBaseDir(), "history.txt");
boolean readonly = ((test.exists() && !test.canWrite()) || (!_context.getBaseDir().canWrite()));
boolean disabled = Boolean.valueOf(_context.getProperty(ConfigUpdateHandler.PROP_UPDATE_DISABLED)).booleanValue();
boolean disabled = _context.getBooleanProperty(ConfigUpdateHandler.PROP_UPDATE_DISABLED);
return readonly || disabled;
}
@ -220,7 +220,7 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener {
public void fetchNews() {
String newsURL = ConfigUpdateHelper.getNewsURL(_context);
boolean shouldProxy = Boolean.valueOf(_context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY)).booleanValue();
boolean shouldProxy = Boolean.parseBoolean(_context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY));
String proxyHost = _context.getProperty(ConfigUpdateHandler.PROP_PROXY_HOST, ConfigUpdateHandler.DEFAULT_PROXY_HOST);
int proxyPort = ConfigUpdateHandler.proxyPort(_context);
if (_tempFile.exists())
@ -252,7 +252,7 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener {
public boolean shouldFetchUnsigned() {
String url = _context.getProperty(ConfigUpdateHandler.PROP_ZIP_URL);
return url != null && url.length() > 0 &&
Boolean.valueOf(_context.getProperty(ConfigUpdateHandler.PROP_UPDATE_UNSIGNED)).booleanValue() &&
_context.getBooleanProperty(ConfigUpdateHandler.PROP_UPDATE_UNSIGNED) &&
!dontInstall();
}
@ -265,7 +265,7 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener {
if (url == null || url.length() <= 0)
return;
// assume always proxied for now
//boolean shouldProxy = Boolean.valueOf(_context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY)).booleanValue();
//boolean shouldProxy = Boolean.parseBoolean(_context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY));
String proxyHost = _context.getProperty(ConfigUpdateHandler.PROP_PROXY_HOST, ConfigUpdateHandler.DEFAULT_PROXY_HOST);
int proxyPort = _context.getProperty(ConfigUpdateHandler.PROP_PROXY_PORT, ConfigUpdateHandler.DEFAULT_PROXY_PORT_INT);

View File

@ -61,12 +61,12 @@ public class PluginStarter implements Runnable {
}
static boolean pluginsEnabled(I2PAppContext ctx) {
return Boolean.valueOf(ctx.getProperty("router.enablePlugins", "true")).booleanValue();
return ctx.getBooleanPropertyDefaultTrue("router.enablePlugins");
}
public void run() {
if (_context.getBooleanPropertyDefaultTrue("plugins.autoUpdate") &&
(!Boolean.valueOf(System.getProperty(UpdateHandler.PROP_UPDATE_IN_PROGRESS)).booleanValue()) &&
(!Boolean.parseBoolean(System.getProperty(UpdateHandler.PROP_UPDATE_IN_PROGRESS))) &&
(!RouterVersion.VERSION.equals(_context.getProperty("router.previousVersion"))))
updateAll(_context, true);
startPlugins(_context);
@ -169,7 +169,7 @@ public class PluginStarter implements Runnable {
for (Iterator iter = props.keySet().iterator(); iter.hasNext(); ) {
String name = (String)iter.next();
if (name.startsWith(PREFIX) && name.endsWith(ENABLED)) {
if (Boolean.valueOf(props.getProperty(name)).booleanValue()) {
if (Boolean.parseBoolean(props.getProperty(name))) {
String app = name.substring(PREFIX.length(), name.lastIndexOf(ENABLED));
// plugins could have been started after update
if (isPluginRunning(app, ctx))
@ -508,7 +508,7 @@ public class PluginStarter implements Runnable {
public static boolean isPluginEnabled(String appName) {
Properties props = pluginProperties();
String prop = PREFIX + appName + ENABLED;
return Boolean.valueOf(props.getProperty(prop, "true")).booleanValue();
return Boolean.parseBoolean(props.getProperty(prop, "true"));
}
/**
@ -519,7 +519,7 @@ public class PluginStarter implements Runnable {
public static void disablePlugin(String appName) {
Properties props = pluginProperties();
String prop = PREFIX + appName + ENABLED;
if (Boolean.valueOf(props.getProperty(prop, "true")).booleanValue()) {
if (Boolean.parseBoolean(props.getProperty(prop, "true"))) {
props.setProperty(prop, "false");
storePluginProperties(props);
}

View File

@ -139,7 +139,7 @@ public class PluginUpdateHandler extends UpdateHandler {
} else {
updateStatus("<b>" + _("Downloading plugin from {0}", _xpi2pURL) + "</b>");
// use the same settings as for updater
boolean shouldProxy = Boolean.valueOf(_context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY)).booleanValue();
boolean shouldProxy = Boolean.parseBoolean(_context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY));
String proxyHost = _context.getProperty(ConfigUpdateHandler.PROP_PROXY_HOST, ConfigUpdateHandler.DEFAULT_PROXY_HOST);
int proxyPort = ConfigUpdateHandler.proxyPort(_context);
try {
@ -313,7 +313,7 @@ public class PluginUpdateHandler extends UpdateHandler {
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>" + _("Downloaded plugin is for new installs only, but the plugin is already installed", url) + "</b>");
return;
@ -374,7 +374,7 @@ public class PluginUpdateHandler extends UpdateHandler {
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)) {
@ -405,7 +405,7 @@ public class PluginUpdateHandler extends UpdateHandler {
}
update = true;
} else {
if (Boolean.valueOf(props.getProperty("update-only")).booleanValue()) {
if (Boolean.parseBoolean(props.getProperty("update-only"))) {
to.delete();
statusDone("<b>" + _("Plugin is for upgrades only, but the plugin is not installed") + "</b>");
return;
@ -426,7 +426,7 @@ public class PluginUpdateHandler extends UpdateHandler {
_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>" + _("Plugin {0} installed", appName) + "</b>");
if(!update) {
Properties pluginProps = PluginStarter.pluginProperties();

View File

@ -120,8 +120,8 @@ public class SummaryHelper extends HelperBase {
public boolean allowReseed() {
return _context.netDb().isInitialized() &&
((_context.netDb().getKnownRouters() < 30) ||
Boolean.valueOf(_context.getProperty("i2p.alwaysAllowReseed")).booleanValue());
(_context.netDb().getKnownRouters() < 30) ||
_context.getBooleanProperty("i2p.alwaysAllowReseed");
}
/** subtract one for ourselves, so if we know no other peers it displays zero */

View File

@ -169,7 +169,7 @@ public class UpdateHandler {
// Alternative: In bytesTransferred(), Check the data in the output file after
// we've received at least 56 bytes. Need a cancel() method in EepGet ?
boolean shouldProxy = Boolean.valueOf(_context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY)).booleanValue();
boolean shouldProxy = Boolean.parseBoolean(_context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY));
String proxyHost = _context.getProperty(ConfigUpdateHandler.PROP_PROXY_HOST, ConfigUpdateHandler.DEFAULT_PROXY_HOST);
int proxyPort = ConfigUpdateHandler.proxyPort(_context);