[Swift-commit] r7913 - trunk/src/org/griphyn/vdl/util

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Thu Jun 12 20:36:19 CDT 2014


Author: hategan
Date: 2014-06-12 20:36:19 -0500 (Thu, 12 Jun 2014)
New Revision: 7913

Modified:
   trunk/src/org/griphyn/vdl/util/VDL2Config.java
Log:
only check config properties after all the files have been loaded

Modified: trunk/src/org/griphyn/vdl/util/VDL2Config.java
===================================================================
--- trunk/src/org/griphyn/vdl/util/VDL2Config.java	2014-06-12 17:23:20 UTC (rev 7912)
+++ trunk/src/org/griphyn/vdl/util/VDL2Config.java	2014-06-13 01:36:19 UTC (rev 7913)
@@ -79,7 +79,9 @@
 		}
 		c.load(file);
 		config = c;
-		return config.check();
+		config.check();
+		config.validateProperties();
+		return config;
 	}
 
 	private List<String> files, tried;
@@ -153,7 +155,13 @@
 		}
 	}
 
-	protected VDL2Config check() throws IOException {
+	private void validateProperties() {
+	    for (Map.Entry<Object, Object> e : this.entrySet()) {
+	        checkType(e.getKey(), e.getValue());
+	    }
+    }
+
+    protected VDL2Config check() throws IOException {
 		if (files.size() == 0) {
 			throw new FileNotFoundException("No Swift configuration file found. Tried " + tried);
 		}
@@ -175,7 +183,6 @@
 	public synchronized Object put(Object key, Object value) {
 		String svalue = (String) value;
 		if (svalue.indexOf("${") == -1) {
-		    checkType(key, value);
 			return super.put(key, value);
 		}
 		else {
@@ -209,7 +216,6 @@
 			}
 			sb.append(svalue.substring(last));
 			value = sb.toString();
-			checkType(key, value);
 			return super.put(key, value);
 		}
 	}




More information about the Swift-commit mailing list