Karakó Miklós created LANG-1753: ----------------------------------- Summary: StringUtils.replaceEachRepeatedly regression in 3.11+ Key: LANG-1753 URL: https://issues.apache.org/jira/browse/LANG-1753 Project: Commons Lang Issue Type: Bug Components: lang.* Affects Versions: 3.17.0, 3.11 Reporter: Karakó Miklós
The following test fails with Commons Lang 3.11 and 3.17.0: {code} assertThrows( IllegalStateException.class, () -> StringUtils.replaceEachRepeatedly("%{key1}", new String[] {"%{key1}", "%{key2}", "%{key3}"}, new String[] {"Key1 %{key2}", "Key2 %{key3}", "Key3 %{key1}"}), "Should be a circular reference"); {code} While it throws the expected IllegalStateException with 3.10. This commit seems to be related: https://github.com/apache/commons-lang/commit/d62d4e21ef20ee01e65cbf5257e04d6b572aa73b These also produce weird results with 3.11 and 3.17.0: {code} // fails, returns "bllaan" instead of "blaan" // similar to the already existing test in StringUtilsTest assertEquals("blaan", StringUtils.replaceEachRepeatedly("bllllaan", new String[]{"llaan"}, new String[]{"laan"})); {code} {code} // fails, returns "aab" instead of "ab" assertEquals("ab", StringUtils.replaceEachRepeatedly("aaaab", new String[] {"aab"}, new String[] {"ab"})); {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)