You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2020/03/19 00:19:00 UTC
[jira] [Commented] (LANG-1528) replaceEachRepeatedly gives
IllegalStateException
[ https://issues.apache.org/jira/browse/LANG-1528?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17062168#comment-17062168 ]
Gary D. Gregory commented on LANG-1528:
---------------------------------------
Hi [~yolofy]
Please feel free to provide a PR on GitHub at [https://github.com/apache/commons-lang]
> replaceEachRepeatedly gives IllegalStateException
> -------------------------------------------------
>
> Key: LANG-1528
> URL: https://issues.apache.org/jira/browse/LANG-1528
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.*
> Affects Versions: 3.8, 3.9, 3.8.1
> Reporter: jimmy
> Priority: Minor
> Labels: easyfix
>
>
> ChurchilllaanTest1 fails, ChurchilllaanTest2 doesn't, why?
> Please allow the ttl to be overridden.
> {code:java}
> @Test
> public void ChurchilllaanTest1() {
> String input = "Churchilllaan";
> String[][] replaceMap = new String[][] {
> { "llaan", "laan" },
> };
>
> String output = StringUtils.replaceEachRepeatedly(
> input,
> getColumn(0, replaceMap),
> getColumn(1, replaceMap));
> Assert.assertEquals("Churchilaan", output);
> }
> @Test
> public void ChurchilllaanTest2() {
> String input = "Churchilllaan";
> String[][] replaceMap = new String[][] {
> { "llaan", "laan" },
> { "C", "c" },
> };
>
> String output = StringUtils.replaceEachRepeatedly(
> input,
> getColumn(0, replaceMap),
> getColumn(1, replaceMap));
> Assert.assertEquals("churchilaan", output);
> }
> private String[] getColumn(int colIndex, String[][] from) {
> return Arrays.stream(from).map(x -> x[colIndex]).toArray(String[]::new);
> }
> {code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)