[freenet-cvs] r13947 - trunk/freenet/src/freenet/config

toad at freenetproject.org toad at freenetproject.org
Fri Jul 6 14:49:49 UTC 2007


Author: toad
Date: 2007-07-06 14:49:49 +0000 (Fri, 06 Jul 2007)
New Revision: 13947

Modified:
   trunk/freenet/src/freenet/config/SubConfig.java
Log:
Fix NPE

Modified: trunk/freenet/src/freenet/config/SubConfig.java
===================================================================
--- trunk/freenet/src/freenet/config/SubConfig.java	2007-07-05 23:39:50 UTC (rev 13946)
+++ trunk/freenet/src/freenet/config/SubConfig.java	2007-07-06 14:49:49 UTC (rev 13947)
@@ -303,9 +303,14 @@
 	}
 
 	public String getRawOption(String name) {
-		if(config instanceof PersistentConfig)
-			return ((PersistentConfig) config).origConfigFileContents.get(prefix + SimpleFieldSet.MULTI_LEVEL_CHAR + name);
-		else return null;
+		if(config instanceof PersistentConfig) {
+			PersistentConfig pc = (PersistentConfig) config;
+			if(pc.finishedInit)
+				throw new IllegalStateException("getRawOption("+name+") on "+this+" but persistent config has been finishedInit() already!");
+			SimpleFieldSet fs = pc.origConfigFileContents;
+			if(fs == null) return null;
+			return fs.get(prefix + SimpleFieldSet.MULTI_LEVEL_CHAR + name);
+		} else return null;
 	}
 
 }




More information about the cvs mailing list