You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Benedikt Ritter (JIRA)" <ji...@apache.org> on 2016/10/19 11:08:58 UTC

[jira] [Commented] (LANG-1276) [lang] ArrayIndexOutOfBoundsException StrBuilder replace

    [ https://issues.apache.org/jira/browse/LANG-1276?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15588443#comment-15588443 ] 

Benedikt Ritter commented on LANG-1276:
---------------------------------------

[~skotsj] we just released Commons Lang 3.5 Do you see the same problem with 3.5?

Thank you!

> [lang] ArrayIndexOutOfBoundsException StrBuilder replace
> --------------------------------------------------------
>
>                 Key: LANG-1276
>                 URL: https://issues.apache.org/jira/browse/LANG-1276
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 3.2.1, 3.4
>            Reporter: Andreas Skomedal
>
> There is a bug in replace for StrBuilder, seems the use of nonupdated buffer and character count is off.
> new StrBuilder("Dear X, hello X.").replaceAll(StrMatcher.stringMatcher("X"), "012345678901234567");
> yields
> {noformat}
> java.lang.ArrayIndexOutOfBoundsException: 49
> 	at org.apache.commons.lang3.text.StrMatcher$StringMatcher.isMatch(StrMatcher.java:372)
> 	at org.apache.commons.lang3.text.StrBuilder.replaceImpl(StrBuilder.java:2115)
> 	at org.apache.commons.lang3.text.StrBuilder.replace(StrBuilder.java:2088)
> 	at org.apache.commons.lang3.text.StrBuilder.replaceAll(StrBuilder.java:2049)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)