Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 62C42200BCB for ; Wed, 19 Oct 2016 12:18:01 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 61A11160ADE; Wed, 19 Oct 2016 10:18:01 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D44C5160AFC for ; Wed, 19 Oct 2016 12:18:00 +0200 (CEST) Received: (qmail 74107 invoked by uid 500); 19 Oct 2016 10:17:59 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 73755 invoked by uid 99); 19 Oct 2016 10:17:59 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Oct 2016 10:17:59 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 6C16D2C4C7A for ; Wed, 19 Oct 2016 10:17:59 +0000 (UTC) Date: Wed, 19 Oct 2016 10:17:59 +0000 (UTC) From: "Andreas Skomedal (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (LANG-1276) [lang] ArrayIndexOutOfBoundsException StrBuilder replace MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 19 Oct 2016 10:18:01 -0000 Andreas Skomedal created LANG-1276: -------------------------------------- Summary: [lang] ArrayIndexOutOfBoundsException StrBuilder replace Key: LANG-1276 URL: https://issues.apache.org/jira/browse/LANG-1276 Project: Commons Lang Issue Type: Bug 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)