mirror of https://github.com/apache/maven.git
[MNG-8388] Fix escape characters being replaced to change the original configuration (#1946)
* [MNG-8388] Fix escape characters being replaced to change the original configuration Signed-off-by: crazyhzm <crazyhzm@apache.org> * Add unit test --------- Signed-off-by: crazyhzm <crazyhzm@apache.org> Co-authored-by: Guillaume Nodet <gnodet@gmail.com>
This commit is contained in:
parent
01e47259d2
commit
d6edb027c3
|
@ -420,7 +420,7 @@ public class DefaultInterpolator implements Interpolator {
|
|||
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) {
|
||||
if (c == '{' || c == '}') {
|
||||
val = val.substring(0, escape) + val.substring(escape + 1);
|
||||
}
|
||||
escape = val.indexOf(ESCAPE_CHAR, escape + 1);
|
||||
|
|
|
@ -98,6 +98,7 @@ class DefaultInterpolatorTest {
|
|||
assertEquals("${a}", substVars("$\\{a${#}\\}", "b"));
|
||||
assertEquals("${a}", substVars("$\\{a\\}${#}", "b"));
|
||||
assertEquals("${a}", substVars("$\\{a\\}", "b"));
|
||||
assertEquals("\\\\", substVars("\\\\", "b"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue