You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Chen (Jira)" <ji...@apache.org> on 2019/09/05 09:43:00 UTC

[jira] [Commented] (LANG-1453) StringUtils.removeIgnoreCase("İa", "a") throws IndexOutOfBoundsException

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

Chen commented on LANG-1453:
----------------------------

Since case mappings are not always 1:1 char mappings, the resulting may be a different length than the original, so String#toUpperCase & String#toLowerCase can't be used with  String#indexOf which to find position.

How to fix this problem? I think we should use regex. I will try it later.

> StringUtils.removeIgnoreCase("İa", "a") throws IndexOutOfBoundsException
> ------------------------------------------------------------------------
>
>                 Key: LANG-1453
>                 URL: https://issues.apache.org/jira/browse/LANG-1453
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.text.*
>    Affects Versions: 3.8.1
>            Reporter: Thomas Neerup
>            Priority: Critical
>          Time Spent: 2h 40m
>  Remaining Estimate: 0h
>
> *try* {
> String s = StringUtils._removeIgnoreCase_("İa", "a");
> } *catch* (Exception e) {
> e.printStackTrace();
> }
> output
> java.lang.IndexOutOfBoundsException: start 3, end 2, s.length() 2
> at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:539)
>  



--
This message was sent by Atlassian Jira
(v8.3.2#803003)