commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "HiuFung Kwok (JIRA)" <>
Subject [jira] [Commented] (LANG-1406) StringIndexOutOfBoundsException in StringUtils.replaceIgnoreCase
Date Sat, 15 Sep 2018 06:58:00 GMT


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|] 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:
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>            Reporter: Michael Ryan
>            Priority: Major
> {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

View raw message