You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2019/09/11 13:12:58 UTC

[commons-lang] branch master updated (ba1c22c -> d68e2e9)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git.


    from ba1c22c  [LANG-1489] Add null-safe APIs as StringUtils.toRoot[Lower|Upper]Case(String) #456
     new 2af6e9a  [LANG-1489] Add null-safe APIs as StringUtils.toRootLowerCase(String) and StringUtils.toRootUpperCase(String). GitHub #456.
     new d68e2e9  [LANG-1406] StringIndexOutOfBoundsException in StringUtils.replaceIgnoreCase

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/changes/changes.xml                                     | 4 +++-
 src/main/java/org/apache/commons/lang3/StringUtils.java     | 4 ++--
 src/test/java/org/apache/commons/lang3/StringUtilsTest.java | 3 +++
 3 files changed, 8 insertions(+), 3 deletions(-)


[commons-lang] 02/02: [LANG-1406] StringIndexOutOfBoundsException in StringUtils.replaceIgnoreCase

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git

commit d68e2e9125126938399175f424f06301f497b920
Author: geratorres <ge...@users.noreply.github.com>
AuthorDate: Wed Sep 11 09:12:53 2019 -0400

    [LANG-1406] StringIndexOutOfBoundsException in
    StringUtils.replaceIgnoreCase
    
    Closes #423.
---
 src/changes/changes.xml                                     | 5 +++--
 src/main/java/org/apache/commons/lang3/StringUtils.java     | 4 ++--
 src/test/java/org/apache/commons/lang3/StringUtilsTest.java | 3 +++
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 1a37c7c..0ed0db0 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -64,8 +64,9 @@ The <action> type attribute can be add,update,fix,remove.
     <action issue="LANG-1475" type="fix" dev="kinow" due-to="stzx">StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException.</action>
     <action issue="LANG-1485" type="add" dev="ggregory" due-to="nicolasbd">Add getters for lhs and rhs objects in DiffResult #451.</action>
     <action issue="LANG-1486" type="add" dev="ggregory" due-to="Gary Gregory">Generify builder classes Diffable, DiffBuilder, and DiffResult #452.</action>
-    <action issue="LANG-1487" type="add" dev="ggregory" due-to="Gary Gregory">Add ClassLoaderUtils with toString() implementations. #453.</action>
-    <action issue="LANG-1489" type="add" dev="ggregory" due-to="Gary Gregory">Add null-safe APIs as StringUtils.toRootLowerCase(String) and StringUtils.toRootUpperCase(String). #456.</action>
+    <action issue="LANG-1487" type="add" dev="ggregory" due-to="Gary Gregory">Add ClassLoaderUtils with toString() implementations #453.</action>
+    <action issue="LANG-1489" type="add" dev="ggregory" due-to="Gary Gregory">Add null-safe APIs as StringUtils.toRootLowerCase(String) and StringUtils.toRootUpperCase(String) #456.</action>
+    <action issue="LANG-1406" type="add" dev="ggregory" due-to="geratorres">StringIndexOutOfBoundsException in StringUtils.replaceIgnoreCase #423.</action>
   </release>
 
   <release version="3.9" date="2019-04-09" description="New features and bug fixes. Requires Java 8, supports Java 9, 10, 11.">
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index 7741303..a2402b1 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -6369,7 +6369,7 @@ public class StringUtils {
              searchString = searchString.toLowerCase();
          }
          int start = 0;
-         int end = searchText.indexOf(searchString, start);
+         int end = ignoreCase ? indexOfIgnoreCase(text, searchString, start) : indexOf(text, searchString, start);
          if (end == INDEX_NOT_FOUND) {
              return text;
          }
@@ -6384,7 +6384,7 @@ public class StringUtils {
              if (--max == 0) {
                  break;
              }
-             end = searchText.indexOf(searchString, start);
+             end = ignoreCase ? indexOfIgnoreCase(text, searchString, start) : indexOf(text, searchString, start);
          }
          buf.append(text, start, text.length());
          return buf.toString();
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
index 7063fc8..29b368a 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
@@ -1684,6 +1684,9 @@ public class StringUtilsTest {
 
         // StringUtils.removeIgnoreCase("queued", "zZ") = "queued"
         assertEquals("queued", StringUtils.removeIgnoreCase("queued", "zZ"));
+        
+        // StringUtils.removeIgnoreCase("\u0130x", "x") = "\u0130"
+        assertEquals("\u0130", StringUtils.removeIgnoreCase("\u0130x", "x"));
     }
 
     @Test


[commons-lang] 01/02: [LANG-1489] Add null-safe APIs as StringUtils.toRootLowerCase(String) and StringUtils.toRootUpperCase(String). GitHub #456.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git

commit 2af6e9aa58558d38d9c134a3632b0e5b1dc38d90
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Sep 11 09:08:31 2019 -0400

    [LANG-1489] Add null-safe APIs as StringUtils.toRootLowerCase(String)
    and StringUtils.toRootUpperCase(String). GitHub #456.
---
 src/changes/changes.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index c256342..1a37c7c 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -65,6 +65,7 @@ The <action> type attribute can be add,update,fix,remove.
     <action issue="LANG-1485" type="add" dev="ggregory" due-to="nicolasbd">Add getters for lhs and rhs objects in DiffResult #451.</action>
     <action issue="LANG-1486" type="add" dev="ggregory" due-to="Gary Gregory">Generify builder classes Diffable, DiffBuilder, and DiffResult #452.</action>
     <action issue="LANG-1487" type="add" dev="ggregory" due-to="Gary Gregory">Add ClassLoaderUtils with toString() implementations. #453.</action>
+    <action issue="LANG-1489" type="add" dev="ggregory" due-to="Gary Gregory">Add null-safe APIs as StringUtils.toRootLowerCase(String) and StringUtils.toRootUpperCase(String). #456.</action>
   </release>
 
   <release version="3.9" date="2019-04-09" description="New features and bug fixes. Requires Java 8, supports Java 9, 10, 11.">