[Swift-commit] r7914 - branches/release-0.95/src/org/griphyn/vdl/util

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Thu Jun 12 20:38:21 CDT 2014


Author: hategan
Date: 2014-06-12 20:38:21 -0500 (Thu, 12 Jun 2014)
New Revision: 7914

Modified:
   branches/release-0.95/src/org/griphyn/vdl/util/VDL2Config.java
Log:
only check properties after all files have been loaded

Modified: branches/release-0.95/src/org/griphyn/vdl/util/VDL2Config.java
===================================================================
--- branches/release-0.95/src/org/griphyn/vdl/util/VDL2Config.java	2014-06-13 01:36:19 UTC (rev 7913)
+++ branches/release-0.95/src/org/griphyn/vdl/util/VDL2Config.java	2014-06-13 01:38:21 UTC (rev 7914)
@@ -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