FELIX-1476: Allow system property substitution while loading configurations from files

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@804097 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/fileinstall/src/main/java/org/apache/felix/fileinstall/DirectoryWatcher.java b/fileinstall/src/main/java/org/apache/felix/fileinstall/DirectoryWatcher.java
index 9530d0f..6f0a933 100644
--- a/fileinstall/src/main/java/org/apache/felix/fileinstall/DirectoryWatcher.java
+++ b/fileinstall/src/main/java/org/apache/felix/fileinstall/DirectoryWatcher.java
@@ -273,8 +273,23 @@
 
         Properties p = new Properties();
         InputStream in = new FileInputStream(f);
-        p.load(in);
-        in.close();
+        try
+        {
+            p.load(in);
+        }
+        finally
+        {
+            in.close();
+        }
+        for (Enumeration e = p.keys(); e.hasMoreElements(); )
+        {
+            String name = (String) e.nextElement();
+            Object value = p.get(name);
+            p.put(name,
+                value instanceof String
+                    ? Util.substVars((String) value, name, null, p)
+                    : value);
+        }
         String pid[] = parsePid(f.getName());
         Hashtable ht = new Hashtable();
         ht.putAll(p);