felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r804097 - /felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/DirectoryWatcher.java
Date Fri, 14 Aug 2009 07:09:51 GMT
Author: gnodet
Date: Fri Aug 14 07:09:51 2009
New Revision: 804097

URL: http://svn.apache.org/viewvc?rev=804097&view=rev
Log:
FELIX-1476: Allow system property substitution while loading configurations from files

Modified:
    felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/DirectoryWatcher.java

Modified: felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/DirectoryWatcher.java
URL: http://svn.apache.org/viewvc/felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/DirectoryWatcher.java?rev=804097&r1=804096&r2=804097&view=diff
==============================================================================
--- felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/DirectoryWatcher.java
(original)
+++ felix/trunk/fileinstall/src/main/java/org/apache/felix/fileinstall/DirectoryWatcher.java
Fri Aug 14 07:09:51 2009
@@ -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);



Mime
View raw message