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 2020/05/25 13:48:24 UTC

[commons-lang] branch master updated: [LANG-1545] CharSequenceUtils.regionMatches is wrong dealing with Georgian.

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


The following commit(s) were added to refs/heads/master by this push:
     new 71ee021  [LANG-1545] CharSequenceUtils.regionMatches is wrong dealing with Georgian.
71ee021 is described below

commit 71ee021ca5fa4ca5a6f414c05666aedc79bde78d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon May 25 09:48:20 2020 -0400

    [LANG-1545] CharSequenceUtils.regionMatches is wrong dealing with
    Georgian.
---
 src/changes/changes.xml                                     |  1 +
 src/test/java/org/apache/commons/lang3/StringUtilsTest.java | 12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index bc55ac2..1df43f2 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -58,6 +58,7 @@ The <action> type attribute can be add,update,fix,remove.
     <action issue="LANG-1534" type="update" dev="ggregory" due-to="Isira Seneviratne, Bruno P. Kinoshita">Replace some usages of the ternary operator with calls to Math.max() and Math.min() #512.</action>
     <action                   type="update" dev="ggregory" due-to="Arend v. Reinersdorff, Bruno P. Kinoshita">(Javadoc) Fix return tag for throwableOf*() methods #518.</action>
     <action                   type="add" dev="ggregory" due-to="XenoAmess, Gary Gregory">Add ArrayUtils.isSameLength() to compare more array types #430.</action>
+    <action issue="LANG-1545" type="update" dev="ggregory" due-to="XenoAmess, Gary Gregory">CharSequenceUtils.regionMatches is wrong dealing with Georgian.</action>
   </release>
 
   <release version="3.10" date="2020-03-22" description="New features and bug fixes. Requires Java 8, supports Java 9, 10, 11.">
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
index cea53a2..a1eb66a 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
@@ -3322,13 +3322,21 @@ public class StringUtilsTest {
         };
         for (char i : arrayI) {
             for (char j : arrayJ) {
-                String si = "" + i;
-                String sj = "" + j;
+                String si = String.valueOf(i);
+                String sj = String.valueOf(j);
                 boolean res1 = si.equalsIgnoreCase(sj);
                 CharSequence ci = new StringBuilder(si);
                 CharSequence cj = new StringBuilder(sj);
                 boolean res2 = StringUtils.startsWithIgnoreCase(ci, cj);
                 assertEquals(res1, res2, "si : " + si + " sj : " + sj);
+                res2 = StringUtils.endsWithIgnoreCase(ci, cj);
+                assertEquals(res1, res2, "si : " + si + " sj : " + sj);
+                res2 = StringUtils.compareIgnoreCase(ci.toString(), cj.toString()) == 0;
+                assertEquals(res1, res2, "si : " + si + " sj : " + sj);
+                res2 = StringUtils.indexOfIgnoreCase(ci.toString(), cj.toString()) == 0;
+                assertEquals(res1, res2, "si : " + si + " sj : " + sj);
+                res2 = StringUtils.lastIndexOfIgnoreCase(ci.toString(), cj.toString()) == 0;
+                assertEquals(res1, res2, "si : " + si + " sj : " + sj);
             }
         }
     }