[FELIX-3847] Variables are not preserved during write-back if they are defined as framework properties
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1348779 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/fileinstall/pom.xml b/fileinstall/pom.xml
index 5de0962..9767e0a 100644
--- a/fileinstall/pom.xml
+++ b/fileinstall/pom.xml
@@ -58,7 +58,7 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.utils</artifactId>
- <version>1.1.0</version>
+ <version>1.1.3-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
diff --git a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/ConfigInstaller.java b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/ConfigInstaller.java
index c28c70f..f7f1ae0 100644
--- a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/ConfigInstaller.java
+++ b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/ConfigInstaller.java
@@ -117,7 +117,7 @@
if( file != null && file.isFile() ) {
if( fileName.endsWith( ".cfg" ) )
{
- org.apache.felix.utils.properties.Properties props = new org.apache.felix.utils.properties.Properties( file );
+ org.apache.felix.utils.properties.Properties props = new org.apache.felix.utils.properties.Properties( file, context );
for( Enumeration e = dict.keys(); e.hasMoreElements(); )
{
String key = e.nextElement().toString();
diff --git a/utils/src/main/java/org/apache/felix/utils/properties/Properties.java b/utils/src/main/java/org/apache/felix/utils/properties/Properties.java
index a0cbf36..c8ca0eb 100644
--- a/utils/src/main/java/org/apache/felix/utils/properties/Properties.java
+++ b/utils/src/main/java/org/apache/felix/utils/properties/Properties.java
@@ -41,6 +41,8 @@
import java.util.Map;
import java.util.Set;
+import org.osgi.framework.BundleContext;
+
/**
* <p>
* Enhancement of the standard <code>Properties</code>
@@ -84,12 +86,18 @@
private List<String> header;
private List<String> footer;
private File location;
+ private BundleContext context;
public Properties() {
}
public Properties(File location) throws IOException {
+ this(location, null);
+ }
+
+ public Properties(File location, BundleContext context) throws IOException {
this.location = location;
+ this.context = context;
if(location.exists())
load(location);
}
@@ -339,7 +347,13 @@
new ArrayList<String>(reader.getValueLines())));
}
footer = new ArrayList<String>(reader.getCommentLines());
- InterpolationHelper.performSubstitution(storage);
+ if(context != null)
+ {
+ InterpolationHelper.performSubstitution(storage, context);
+ }
+ else {
+ InterpolationHelper.performSubstitution(storage);
+ }
}
/**