alhudz commented on PR #1834:
URL: https://github.com/apache/commons-lang/pull/1834#issuecomment-6394072336

   Yes, Commons Text has the same issue. `StringSubstitutor.substitute` uses 
the same check (`pos > offset && builder.charAt(pos - 1) == escapeCh`), both in 
1.15.0 and on current master, so a value's trailing escape char gets read as a 
template escape there as well.
   
   Repro against 1.15.0:
   
   ```java
   Map<String, String> m = Map.of("price", "5$", "x", "X", "a", "$", "b", "B");
   StringSubstitutor s = new StringSubstitutor(m);
   s.replace("${price}${x}"); // expected "5$X", actual "5${x}"
   s.replace("${a}${b}");     // expected "$B",  actual "${b}"
   ```
   
   Same fix should carry over: only accept an escape at or after the end of the 
last substitution. I can open a Commons Text PR for it with your new tests 
ported over, if that works for you. Thanks for merging, and for the extra tests.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to