Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
gboissinot committed Mar 21, 2012
1 parent 8c84404 commit 7cad840
Showing 1 changed file with 8 additions and 3 deletions.
Expand Up @@ -166,7 +166,8 @@ public void resolveVars(Map<String, String> variables, Map<String, String> env)

//Resolve variables against env
for (Map.Entry<String, String> entry : variables.entrySet()) {
entry.setValue(Util.replaceMacro(entry.getValue(), env));
String value = Util.replaceMacro(entry.getValue(), env);
entry.setValue(value);
}

//Resolve variables against variables itself
Expand All @@ -193,7 +194,7 @@ private Map<String, String> removeUnsetVars(Map<String, String> envVars) {
Map<String, String> result = new HashMap<String, String>();
for (Map.Entry<String, String> entry : envVars.entrySet()) {
if (!isUnresolvedVar(entry.getValue())) {
result.put(entry.getKey(), entry.getValue());
result.put(entry.getKey(), removeEscapeDollar(entry.getValue()));
} else {
logger.info(String.format("Unset unresolved '%s' variable.", entry.getKey()));
}
Expand All @@ -202,7 +203,11 @@ private Map<String, String> removeUnsetVars(Map<String, String> envVars) {
}

private boolean isUnresolvedVar(String value) {
return value != null && value.contains("$");
return value != null && value.contains("$") && !value.contains("\\$");
}

private String removeEscapeDollar(String value) {
return value.replace("\\$", "$");
}

}

0 comments on commit 7cad840

Please sign in to comment.