FELIX=2307: There is no way to bypass / escape property substitution
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@938978 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/Util.java b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/Util.java
index b22c633..ed39a52 100644
--- a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/Util.java
+++ b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/Util.java
@@ -44,6 +44,7 @@
public class Util
{
+ private static final char ESCAPE_CHAR = '\\';
private static final String DELIM_START = "${";
private static final String DELIM_STOP = "}";
@@ -106,6 +107,10 @@
// will correspond to the first deepest nested variable
// placeholder.
int stopDelim = val.indexOf(DELIM_STOP);
+ while (stopDelim > 0 && val.charAt(stopDelim - 1) == ESCAPE_CHAR)
+ {
+ stopDelim = val.indexOf(DELIM_STOP, stopDelim + 1);
+ }
// Find the matching starting "${" variable delimiter
// by looping until we find a start delimiter that is
@@ -166,6 +171,18 @@
// be substitutions to make.
val = substVars(val, currentKey, cycleMap, configProps);
+ // Remove escape characters preceding {, } and \
+ int escape = val.indexOf(ESCAPE_CHAR);
+ while (escape >= 0 && escape < val.length() - 1)
+ {
+ char c = val.charAt(escape + 1);
+ if (c == '{' || c == '}' || c == ESCAPE_CHAR)
+ {
+ val = val.substring(0, escape) + val.substring(escape + 1);
+ }
+ escape = val.indexOf(ESCAPE_CHAR, escape + 1);
+ }
+
// Return the value.
return val;
}