forked from I2P_Developers/i2p.i2p
Boolean.valueOf(x).booleanValue() -> Boolean.parseBoolean(x)
This commit is contained in:
@@ -694,7 +694,7 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
|
||||
public void runClient(String args[], Logging l) {
|
||||
boolean isShared = true;
|
||||
if (args.length >= 3)
|
||||
isShared = Boolean.valueOf(args[2].trim()).booleanValue();
|
||||
isShared = Boolean.parseBoolean(args[2].trim());
|
||||
if (args.length >= 2) {
|
||||
int portNum = -1;
|
||||
try {
|
||||
@@ -766,7 +766,7 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
|
||||
String proxy = "";
|
||||
boolean isShared = true;
|
||||
if (args.length > 1) {
|
||||
if (Boolean.valueOf(args[1].trim()).booleanValue()) {
|
||||
if (Boolean.parseBoolean(args[1].trim())) {
|
||||
isShared = true;
|
||||
if (args.length == 3)
|
||||
proxy = args[2];
|
||||
@@ -835,7 +835,7 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
|
||||
String proxy = "";
|
||||
boolean isShared = true;
|
||||
if (args.length > 1) {
|
||||
if (Boolean.valueOf(args[1].trim()).booleanValue()) {
|
||||
if (Boolean.parseBoolean(args[1].trim())) {
|
||||
isShared = true;
|
||||
if (args.length == 3)
|
||||
proxy = args[2];
|
||||
@@ -906,7 +906,7 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
|
||||
|
||||
boolean isShared = true;
|
||||
if (args.length > 2) {
|
||||
if (Boolean.valueOf(args[2].trim()).booleanValue()) {
|
||||
if (Boolean.parseBoolean(args[2].trim())) {
|
||||
isShared = true;
|
||||
} else if ("false".equalsIgnoreCase(args[2].trim())) {
|
||||
_log.warn("args[2] == [" + args[2] + "] and rejected explicitly");
|
||||
@@ -973,7 +973,7 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
|
||||
|
||||
boolean isShared = false;
|
||||
if (args.length > 1)
|
||||
isShared = Boolean.valueOf(args[1].trim()).booleanValue();
|
||||
isShared = Boolean.parseBoolean(args[1].trim());
|
||||
|
||||
ownDest = !isShared;
|
||||
try {
|
||||
@@ -1017,7 +1017,7 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
|
||||
|
||||
boolean isShared = false;
|
||||
if (args.length == 2)
|
||||
isShared = Boolean.valueOf(args[1].trim()).booleanValue();
|
||||
isShared = Boolean.parseBoolean(args[1].trim());
|
||||
|
||||
ownDest = !isShared;
|
||||
String privateKeyFile = null;
|
||||
|
@@ -190,11 +190,11 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
||||
// no need to load the netDb with leaseSets for destinations that will never
|
||||
// be looked up
|
||||
boolean dccEnabled = (this instanceof I2PTunnelIRCClient) &&
|
||||
Boolean.valueOf(tunnel.getClientOptions().getProperty(I2PTunnelIRCClient.PROP_DCC)).booleanValue();
|
||||
Boolean.parseBoolean(tunnel.getClientOptions().getProperty(I2PTunnelIRCClient.PROP_DCC));
|
||||
if (!dccEnabled)
|
||||
tunnel.getClientOptions().setProperty("i2cp.dontPublishLeaseSet", "true");
|
||||
|
||||
boolean openNow = !Boolean.valueOf(tunnel.getClientOptions().getProperty("i2cp.delayOpen")).booleanValue();
|
||||
boolean openNow = !Boolean.parseBoolean(tunnel.getClientOptions().getProperty("i2cp.delayOpen"));
|
||||
if (openNow) {
|
||||
while (sockMgr == null) {
|
||||
verifySocketManager();
|
||||
@@ -258,8 +258,8 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
||||
if (sess == null) {
|
||||
newManager = true;
|
||||
} else if (sess.isClosed() &&
|
||||
Boolean.valueOf(getTunnel().getClientOptions().getProperty("i2cp.closeOnIdle")).booleanValue() &&
|
||||
Boolean.valueOf(getTunnel().getClientOptions().getProperty("i2cp.newDestOnResume")).booleanValue()) {
|
||||
Boolean.parseBoolean(getTunnel().getClientOptions().getProperty("i2cp.closeOnIdle")) &&
|
||||
Boolean.parseBoolean(getTunnel().getClientOptions().getProperty("i2cp.newDestOnResume"))) {
|
||||
// build a new socket manager and a new dest if the session is closed.
|
||||
getTunnel().removeSession(sess);
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
|
@@ -253,7 +253,7 @@ public class I2PTunnelConnectClient extends I2PTunnelHTTPClientBase implements R
|
||||
line = null;
|
||||
} else {
|
||||
// Add Proxy-Authentication header for next hop (outproxy)
|
||||
if (usingWWWProxy && Boolean.valueOf(getTunnel().getClientOptions().getProperty(PROP_OUTPROXY_AUTH)).booleanValue()) {
|
||||
if (usingWWWProxy && Boolean.parseBoolean(getTunnel().getClientOptions().getProperty(PROP_OUTPROXY_AUTH))) {
|
||||
// specific for this proxy
|
||||
String user = getTunnel().getClientOptions().getProperty(PROP_OUTPROXY_USER_PREFIX + currentProxy);
|
||||
String pw = getTunnel().getClientOptions().getProperty(PROP_OUTPROXY_PW_PREFIX + currentProxy);
|
||||
|
@@ -521,7 +521,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
// Try to find an address helper in the query
|
||||
String[] helperStrings = removeHelper(query);
|
||||
if(helperStrings != null &&
|
||||
!Boolean.valueOf(getTunnel().getClientOptions().getProperty(PROP_DISABLE_HELPER)).booleanValue()) {
|
||||
!Boolean.parseBoolean(getTunnel().getClientOptions().getProperty(PROP_DISABLE_HELPER))) {
|
||||
query = helperStrings[0];
|
||||
if(query.equals("")) {
|
||||
query = null;
|
||||
@@ -736,7 +736,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
} else if(lowercaseLine.startsWith("user-agent: ")) {
|
||||
// save for deciding whether to offer address book form
|
||||
userAgent = lowercaseLine.substring(12);
|
||||
if(!Boolean.valueOf(getTunnel().getClientOptions().getProperty(PROP_USER_AGENT)).booleanValue()) {
|
||||
if(!Boolean.parseBoolean(getTunnel().getClientOptions().getProperty(PROP_USER_AGENT))) {
|
||||
line = null;
|
||||
continue;
|
||||
}
|
||||
@@ -746,13 +746,13 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
line = null;
|
||||
continue;
|
||||
} else if(lowercaseLine.startsWith("referer: ") &&
|
||||
!Boolean.valueOf(getTunnel().getClientOptions().getProperty(PROP_REFERER)).booleanValue()) {
|
||||
!Boolean.parseBoolean(getTunnel().getClientOptions().getProperty(PROP_REFERER))) {
|
||||
// Shouldn't we be more specific, like accepting in-site referers ?
|
||||
//line = "Referer: i2p";
|
||||
line = null;
|
||||
continue; // completely strip the line
|
||||
} else if(lowercaseLine.startsWith("via: ") &&
|
||||
!Boolean.valueOf(getTunnel().getClientOptions().getProperty(PROP_VIA)).booleanValue()) {
|
||||
!Boolean.parseBoolean(getTunnel().getClientOptions().getProperty(PROP_VIA))) {
|
||||
//line = "Via: i2p";
|
||||
line = null;
|
||||
continue; // completely strip the line
|
||||
@@ -786,7 +786,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
String ok = getTunnel().getClientOptions().getProperty("i2ptunnel.gzip");
|
||||
boolean gzip = DEFAULT_GZIP;
|
||||
if(ok != null) {
|
||||
gzip = Boolean.valueOf(ok).booleanValue();
|
||||
gzip = Boolean.parseBoolean(ok);
|
||||
}
|
||||
if(gzip && !usingInternalServer) {
|
||||
// according to rfc2616 s14.3, this *should* force identity, even if
|
||||
@@ -796,7 +796,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
newRequest.append("X-Accept-Encoding: x-i2p-gzip;q=1.0, identity;q=0.5, deflate;q=0, gzip;q=0, *;q=0\r\n");
|
||||
}
|
||||
if(!shout) {
|
||||
if(!Boolean.valueOf(getTunnel().getClientOptions().getProperty(PROP_USER_AGENT)).booleanValue()) {
|
||||
if(!Boolean.parseBoolean(getTunnel().getClientOptions().getProperty(PROP_USER_AGENT))) {
|
||||
// let's not advertise to external sites that we are from I2P
|
||||
if(usingWWWProxy) {
|
||||
newRequest.append("User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6\r\n");
|
||||
@@ -806,7 +806,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
}
|
||||
}
|
||||
// Add Proxy-Authentication header for next hop (outproxy)
|
||||
if(usingWWWProxy && Boolean.valueOf(getTunnel().getClientOptions().getProperty(PROP_OUTPROXY_AUTH)).booleanValue()) {
|
||||
if(usingWWWProxy && Boolean.parseBoolean(getTunnel().getClientOptions().getProperty(PROP_OUTPROXY_AUTH))) {
|
||||
// specific for this proxy
|
||||
String user = getTunnel().getClientOptions().getProperty(PROP_OUTPROXY_USER_PREFIX + currentProxy);
|
||||
String pw = getTunnel().getClientOptions().getProperty(PROP_OUTPROXY_PW_PREFIX + currentProxy);
|
||||
@@ -869,7 +869,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
if(usingInternalServer) {
|
||||
// disable the add form if address helper is disabled
|
||||
if(internalPath.equals("/add") &&
|
||||
Boolean.valueOf(getTunnel().getClientOptions().getProperty(PROP_DISABLE_HELPER)).booleanValue()) {
|
||||
Boolean.parseBoolean(getTunnel().getClientOptions().getProperty(PROP_DISABLE_HELPER))) {
|
||||
out.write(ERR_HELPER_DISABLED);
|
||||
} else {
|
||||
LocalHTTPServer.serveLocalFile(out, method, internalPath, internalRawQuery, _proxyNonce);
|
||||
@@ -949,7 +949,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
// Don't do this for eepget, which uses a user-agent of "Wget"
|
||||
if(ahelperNew && "GET".equals(method) &&
|
||||
(userAgent == null || !userAgent.startsWith("Wget")) &&
|
||||
!Boolean.valueOf(getTunnel().getClientOptions().getProperty(PROP_DISABLE_HELPER)).booleanValue()) {
|
||||
!Boolean.parseBoolean(getTunnel().getClientOptions().getProperty(PROP_DISABLE_HELPER))) {
|
||||
writeHelperSaveForm(out, destination, ahelperKey, targetRequest);
|
||||
s.close();
|
||||
return;
|
||||
|
@@ -100,7 +100,7 @@ public abstract class I2PTunnelHTTPClientBase extends I2PTunnelClientBase implem
|
||||
// Ref: RFC 2617
|
||||
// If the socket is an InternalSocket, no auth required.
|
||||
String authRequired = getTunnel().getClientOptions().getProperty(PROP_AUTH);
|
||||
if (Boolean.valueOf(authRequired).booleanValue() ||
|
||||
if (Boolean.parseBoolean(authRequired) ||
|
||||
(authRequired != null && "basic".equals(authRequired.toLowerCase(Locale.US)))) {
|
||||
if (s instanceof InternalSocket) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
|
@@ -154,7 +154,7 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
|
||||
boolean allowGZIP = true;
|
||||
if (opts != null) {
|
||||
String val = opts.getProperty("i2ptunnel.gzip");
|
||||
if ( (val != null) && (!Boolean.valueOf(val).booleanValue()) )
|
||||
if ( (val != null) && (!Boolean.parseBoolean(val)) )
|
||||
allowGZIP = false;
|
||||
}
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
|
@@ -87,7 +87,7 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase {
|
||||
|
||||
setName("IRC Client on " + tunnel.listenHost + ':' + localPort);
|
||||
|
||||
_dccEnabled = Boolean.valueOf(tunnel.getClientOptions().getProperty(PROP_DCC)).booleanValue();
|
||||
_dccEnabled = Boolean.parseBoolean(tunnel.getClientOptions().getProperty(PROP_DCC));
|
||||
// TODO add some prudent tunnel options (or is it too late?)
|
||||
|
||||
startRunning();
|
||||
|
@@ -191,7 +191,7 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
|
||||
if (_usePool) {
|
||||
String usePool = getTunnel().getClientOptions().getProperty(PROP_USE_POOL);
|
||||
if (usePool != null)
|
||||
_usePool = Boolean.valueOf(usePool).booleanValue();
|
||||
_usePool = Boolean.parseBoolean(usePool);
|
||||
else
|
||||
_usePool = DEFAULT_USE_POOL;
|
||||
}
|
||||
|
@@ -536,8 +536,8 @@ public class TunnelController implements Logging {
|
||||
/** default true */
|
||||
public String getSharedClient() { return _config.getProperty("sharedClient", "true"); }
|
||||
/** default true */
|
||||
public boolean getStartOnLoad() { return Boolean.valueOf(_config.getProperty("startOnLoad", "true")).booleanValue(); }
|
||||
public boolean getPersistentClientKey() { return Boolean.valueOf(_config.getProperty("option.persistentClientKey")).booleanValue(); }
|
||||
public boolean getStartOnLoad() { return Boolean.parseBoolean(_config.getProperty("startOnLoad", "true")); }
|
||||
public boolean getPersistentClientKey() { return Boolean.parseBoolean(_config.getProperty("option.persistentClientKey")); }
|
||||
|
||||
public String getMyDestination() {
|
||||
if (_tunnel != null) {
|
||||
|
@@ -61,7 +61,7 @@ public class SOCKS5Server extends SOCKSServer {
|
||||
this.clientSock = clientSock;
|
||||
this.props = props;
|
||||
this.authRequired =
|
||||
Boolean.valueOf(props.getProperty(I2PTunnelHTTPClientBase.PROP_AUTH)).booleanValue() &&
|
||||
Boolean.parseBoolean(props.getProperty(I2PTunnelHTTPClientBase.PROP_AUTH)) &&
|
||||
props.containsKey(I2PTunnelHTTPClientBase.PROP_USER) &&
|
||||
props.containsKey(I2PTunnelHTTPClientBase.PROP_PW);
|
||||
}
|
||||
@@ -181,7 +181,7 @@ public class SOCKS5Server extends SOCKSServer {
|
||||
sendRequestReply(Reply.COMMAND_NOT_SUPPORTED, AddressType.DOMAINNAME, null, "0.0.0.0", 0, out);
|
||||
throw new SOCKSException("BIND command not supported");
|
||||
case Command.UDP_ASSOCIATE:
|
||||
/*** if(!Boolean.valueOf(tunnel.getOptions().getProperty("i2ptunnel.socks.allowUDP")).booleanValue()) {
|
||||
/*** if(!Boolean.parseBoolean(tunnel.getOptions().getProperty("i2ptunnel.socks.allowUDP"))) {
|
||||
_log.debug("UDP ASSOCIATE command is not supported!");
|
||||
sendRequestReply(Reply.COMMAND_NOT_SUPPORTED, AddressType.DOMAINNAME, null, "0.0.0.0", 0, out);
|
||||
throw new SOCKSException("UDP ASSOCIATE command not supported");
|
||||
@@ -463,7 +463,7 @@ public class SOCKS5Server extends SOCKSServer {
|
||||
I2PSocket destSock = tun.createI2PSocket(I2PAppContext.getGlobalContext().namingService().lookup(proxy), proxyOpts);
|
||||
try {
|
||||
DataOutputStream out = new DataOutputStream(destSock.getOutputStream());
|
||||
boolean authAvail = Boolean.valueOf(props.getProperty(I2PTunnelHTTPClientBase.PROP_OUTPROXY_AUTH)).booleanValue();
|
||||
boolean authAvail = Boolean.parseBoolean(props.getProperty(I2PTunnelHTTPClientBase.PROP_OUTPROXY_AUTH));
|
||||
String configUser = null;
|
||||
String configPW = null;
|
||||
if (authAvail) {
|
||||
|
@@ -49,7 +49,7 @@ public class SOCKSServerFactory {
|
||||
switch (socksVer) {
|
||||
case 0x04:
|
||||
// SOCKS version 4/4a
|
||||
if (Boolean.valueOf(props.getProperty(I2PTunnelHTTPClientBase.PROP_AUTH)).booleanValue() &&
|
||||
if (Boolean.parseBoolean(props.getProperty(I2PTunnelHTTPClientBase.PROP_AUTH)) &&
|
||||
props.containsKey(I2PTunnelHTTPClientBase.PROP_USER) &&
|
||||
props.containsKey(I2PTunnelHTTPClientBase.PROP_PW)) {
|
||||
throw new SOCKSException("SOCKS 4/4a not supported when authorization is required");
|
||||
|
@@ -114,7 +114,7 @@ public class EditBean extends IndexBean {
|
||||
public boolean isSharedClient(int tunnel) {
|
||||
TunnelController tun = getController(tunnel);
|
||||
if (tun != null)
|
||||
return Boolean.valueOf(tun.getSharedClient()).booleanValue();
|
||||
return Boolean.parseBoolean(tun.getSharedClient());
|
||||
else
|
||||
return false;
|
||||
}
|
||||
@@ -312,7 +312,7 @@ public class EditBean extends IndexBean {
|
||||
if (tun != null) {
|
||||
Properties opts = getOptions(tun);
|
||||
if (opts != null)
|
||||
return Boolean.valueOf(opts.getProperty(prop)).booleanValue();
|
||||
return Boolean.parseBoolean(opts.getProperty(prop));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -266,7 +266,7 @@ public class IndexBean {
|
||||
}
|
||||
// Only modify other shared tunnels
|
||||
// if the current tunnel is shared, and of supported type
|
||||
if (Boolean.valueOf(cur.getSharedClient()).booleanValue() && isClient(cur.getType())) {
|
||||
if (Boolean.parseBoolean(cur.getSharedClient()) && isClient(cur.getType())) {
|
||||
// all clients use the same I2CP session, and as such, use the same I2CP options
|
||||
List controllers = _group.getControllers();
|
||||
|
||||
@@ -278,7 +278,7 @@ public class IndexBean {
|
||||
|
||||
// Only modify this non-current tunnel
|
||||
// if it belongs to a shared destination, and is of supported type
|
||||
if (Boolean.valueOf(c.getSharedClient()).booleanValue() && isClient(c.getType())) {
|
||||
if (Boolean.parseBoolean(c.getSharedClient()) && isClient(c.getType())) {
|
||||
Properties cOpt = c.getConfig("");
|
||||
if (_tunnelQuantity != null) {
|
||||
cOpt.setProperty("option.inbound.quantity", _tunnelQuantity);
|
||||
|
Reference in New Issue
Block a user