Author: nextgens
Date: 2006-12-04 16:43:03 +0000 (Mon, 04 Dec 2006)
New Revision: 11226
Modified:
trunk/freenet/src/freenet/node/PeerNode.java
Log:
Use Fields.stringToBool where appropriate
Modified: trunk/freenet/src/freenet/node/PeerNode.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerNode.java 2006-12-04 16:15:14 UTC
(rev 11225)
+++ trunk/freenet/src/freenet/node/PeerNode.java 2006-12-04 16:43:03 UTC
(rev 11226)
@@ -368,8 +368,8 @@
if(name == null) throw new FSParseException("No name");
myName = name;
String testnet = fs.get("testnet");
- testnetEnabled = testnet == null ? false :
(testnet.equalsIgnoreCase("true") || testnet.equalsIgnoreCase("yes"));
- if(testnetEnabled != node.testnetEnabled) {
+ testnetEnabled = Fields.stringToBool(fs.get("testnet"), true);
+ if(node.testnetEnabled != testnetEnabled) {
String err = "Ignoring incompatible node "+detectedPeer+" -
peer.testnet="+testnetEnabled+ '(' +testnet+") but
node.testnet="+node.testnetEnabled;
Logger.error(this, err);
throw new PeerParseException(err);
@@ -1691,10 +1691,9 @@
} catch (IllegalBase64Exception e) {
throw new FSParseException(e);
}
- }
- String testnet = fs.get("testnet");
- if(node.testnetEnabled != (testnet == null ? false :
(testnet.equalsIgnoreCase("true") || testnet.equalsIgnoreCase("yes")))) {
- String err = "Preventing connection to node "+detectedPeer+" -
peer.testnet="+!node.testnetEnabled+'(' +testnet+") but
node.testnet="+node.testnetEnabled;
+ }
+ if(node.testnetEnabled != Fields.stringToBool(fs.get("testnet"),
true)) {
+ String err = "Preventing connection to node "+detectedPeer+" -
peer.testnet="+!node.testnetEnabled+'(' +Fields.stringToBool(fs.get("testnet"),
true)+") but node.testnet="+node.testnetEnabled;
Logger.error(this, err);
throw new FSParseException(err);
}