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

HiuFung Kwok commented on LANG-1406:
------------------------------------

Hi [~michaelryan]

I have try to implement your idea into the actual codebase against it. 
According to the theory the out of bound exception should be fixed.
 As one to one mapping is performed during the .toLowerCase process. It's 
guaranteed to always give back the same length of String in 
return.[Here|https://github.com/HiuKwok/commons-lang/commit/a998e3de65a59d0859157f99e6cdf99469aa009f]
 is the commit btw.

However on certain situation seems would leads to mismatch, which I listed the 
fail case on the same commit as well.

> 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