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

ASF GitHub Bot commented on LANG-1406:
--------------------------------------

GitHub user HiuKwok opened a pull request:

    https://github.com/apache/commons-lang/pull/340

    [LANG-1406]  StringIndexOutOfBoundsException in 
StringUtils.replaceIgnoreCase

    Fix for Lang-1406 to avoid any exception while performing 
String.UTils.replaceIgnoreCase() against uniCode String object. 
    
    Plz let me if there have any extra things need to be done for this PR since 
I am the first timer for commons-lang project( add more test case?).
    
    All the best

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/HiuKwok/commons-lang master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/commons-lang/pull/340.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #340
    
----
commit e0f6c7802b5e721019a602bf30b31c79dbf6d233
Author: Hiu Kwok <hiufkwok@...>
Date:   2018-08-08T11:44:51Z

    toUpperCase() > toLowerCase() to avoid unicode string length miscalculation

commit 590f90889bf61a5570bd98b78e73410a07d7410b
Author: Hiu Kwok <hiufkwok@...>
Date:   2018-08-08T11:46:29Z

    Assertion for example mentioned on LANG-1406 Description

----


> StringIndexOutOfBoundsException in StringUtils.replaceIgnoreCase
> ----------------------------------------------------------------
>
>                 Key: LANG-1406
>                 URL: https://issues.apache.org/jira/browse/LANG-1406
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>            Reporter: Michael Ryan
>            Priority: Major
>
> STEPS TO REPRODUCE:
> {code}
> StringUtils.replaceIgnoreCase("\u0130x", "x", "")
> {code}
> EXPECTED: "\u0130" is returned.
> ACTUAL: StringIndexOutOfBoundsException
> This happens because the replace method is assuming that text.length() == 
> text.toLowerCase().length(), which is not true for certain characters.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to