[TEXT-178] StringSubstitutor incorrectly removes some escape characters (original) (raw)

The class StringSubstitutor incorrectly removes escape characters.

Note that these tests pass:

/**
 * Tests interpolation with weird boundary patterns.
 */
@Test
public void testReplaceWeirdPattens() throws IOException {
    doTestNoReplace(StringUtils.EMPTY);
    doTestNoReplace(EMPTY_EXPR);
    doTestNoReplace("${ }");
    doTestNoReplace("${\t}");
    doTestNoReplace("${\n}");
    doTestNoReplace("${\b}");
    doTestNoReplace("${");
    doTestNoReplace("$}");
    doTestNoReplace("$$}");
    doTestNoReplace("}");
    doTestNoReplace("${}$");
    doTestNoReplace("${}$$");
    doTestNoReplace("${${");
    doTestNoReplace("${${}}");
    doTestNoReplace("${$${}}");
    doTestNoReplace("${$$${}}");
    doTestNoReplace("${$$${$}}");
    doTestNoReplace("${${}}");
    doTestNoReplace("${${ }}");
}

But these tests fail:

/**
 * Tests interpolation with weird boundary patterns.
 */
@Test
@Disabled
public void testReplaceWeirdPattensJira() throws IOException {
     doTestNoReplace("$${");
     doTestNoReplace("$${a");
     doTestNoReplace("$$${");
     doTestNoReplace("$$${a");
}

is related to

Bug - A problem which impairs or prevents the functions of the product. TEXT-179 StringSubstitutor incorrectly removes the escape character in "$${${a}"

links to