commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kinow <...@git.apache.org>
Subject [GitHub] commons-lang pull request #340: [LANG-1406] StringIndexOutOfBoundsException ...
Date Mon, 13 Aug 2018 12:20:32 GMT
Github user kinow commented on a diff in the pull request:

    https://github.com/apache/commons-lang/pull/340#discussion_r209587514
  
    --- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java ---
    @@ -5596,8 +5596,8 @@ private static String replace(final String text, String searchString,
final Stri
              }
              String searchText = text;
              if (ignoreCase) {
    -             searchText = text.toLowerCase();
    -             searchString = searchString.toLowerCase();
    +             searchText = text.toUpperCase();
    +             searchString = searchString.toUpperCase();
    --- End diff --
    
    Oohh, great testing @HiuKwok ! Thanks for sharing here.
    
    >Just a quick question what you mean by remove the length( ) mean? Would you mind to
specify more on that?
    
    Sure. I think there could be a possibility to fix the issue by addressing how the length
of the lower'ed/upper'ed text is used https://github.com/apache/commons-lang/blob/590f90889bf61a5570bd98b78e73410a07d7410b/src/main/java/org/apache/commons/lang3/StringUtils.java#L5603
    
    So maybe there could be another way to work around the way we use the strings lengths,
and avoid the exception.


---

Mime
View raw message