Author: toad
Date: 2008-09-18 11:58:13 +0000 (Thu, 18 Sep 2008)
New Revision: 22681

Modified:
   trunk/freenet/src/freenet/config/PersistentConfig.java
   trunk/freenet/src/freenet/node/SecurityLevels.java
Log:
Revert wasNew() code, since the installer creates a minimal freenet.ini to 
establish ports anyway.
setThreatLevel() to get the correct defaults if there was no option set in the 
config file.


Modified: trunk/freenet/src/freenet/config/PersistentConfig.java
===================================================================
--- trunk/freenet/src/freenet/config/PersistentConfig.java      2008-09-17 
15:36:12 UTC (rev 22680)
+++ trunk/freenet/src/freenet/config/PersistentConfig.java      2008-09-18 
11:58:13 UTC (rev 22681)
@@ -11,18 +11,12 @@
 public class PersistentConfig extends Config {

        protected SimpleFieldSet origConfigFileContents;
-       protected boolean wasNew;
        protected volatile boolean finishedInit;

        public PersistentConfig(SimpleFieldSet initialContents) {
                this.origConfigFileContents = initialContents;
-               wasNew = initialContents == null;
        }

-       public boolean wasNew() {
-               return wasNew;
-       }
-       
        /**
         * Finished initialization. So any remaining options must be invalid.
         */

Modified: trunk/freenet/src/freenet/node/SecurityLevels.java
===================================================================
--- trunk/freenet/src/freenet/node/SecurityLevels.java  2008-09-17 15:36:12 UTC 
(rev 22680)
+++ trunk/freenet/src/freenet/node/SecurityLevels.java  2008-09-18 11:58:13 UTC 
(rev 22681)
@@ -98,7 +98,7 @@
                };
                myConfig.register("networkThreatLevel", "HIGH", sortOrder++, 
false, true, "SecurityLevels.networkThreatLevelShort", 
"SecurityLevels.networkThreatLevel", networkThreatLevelCallback);
                NETWORK_THREAT_LEVEL netLevel = 
NETWORK_THREAT_LEVEL.valueOf(myConfig.getString("networkThreatLevel"));
-               if(!config.wasNew()) {
+               if(myConfig.getRawOption("networkThreatLevel") != null) {
                        networkThreatLevel = netLevel;
                } else {
                        // Call all the callbacks so that the config is 
consistent with the threat level.
@@ -139,7 +139,7 @@
                };
                myConfig.register("friendsThreatLevel", "NORMAL", sortOrder++, 
false, true, "SecurityLevels.friendsThreatLevelShort", 
"SecurityLevels.friendsThreatLevel", friendsThreatLevelCallback);
                FRIENDS_THREAT_LEVEL friendsLevel = 
FRIENDS_THREAT_LEVEL.valueOf(myConfig.getString("friendsThreatLevel"));;
-               if(!config.wasNew()) {
+               if(myConfig.getRawOption("friendsThreatLevel") != null) {
                        friendsThreatLevel = friendsLevel;
                } else {
                        // Call all the callbacks so that the config is 
consistent with the threat level.
@@ -180,7 +180,7 @@
                };
                myConfig.register("physicalThreatLevel", "NORMAL", sortOrder++, 
false, true, "SecurityLevels.physicalThreatLevelShort", 
"SecurityLevels.physicalThreatLevel", physicalThreatLevelCallback);
                PHYSICAL_THREAT_LEVEL physLevel = 
PHYSICAL_THREAT_LEVEL.valueOf(myConfig.getString("physicalThreatLevel"));
-               if(!config.wasNew()) {
+               if(myConfig.getRawOption("physicalThreatLevel") != null) {
                        physicalThreatLevel = physLevel;
                } else {
                        // Call all the callbacks so that the config is 
consistent with the threat level.


Reply via email to