commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ki...@apache.org
Subject svn commit: r1645101 - in /commons/proper/lang/trunk/src: changes/changes.xml main/java/org/apache/commons/lang3/StringUtils.java test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
Date Sat, 13 Dec 2014 02:00:19 GMT
Author: kinow
Date: Sat Dec 13 02:00:18 2014
New Revision: 1645101

URL: http://svn.apache.org/r1645101
Log:
LANG-1077 StringUtils.ordinalIndexOf("aaaaaa", "aa", 2) != 3 in StringUtils

Modified:
    commons/proper/lang/trunk/src/changes/changes.xml
    commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java

Modified: commons/proper/lang/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/changes/changes.xml?rev=1645101&r1=1645100&r2=1645101&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/changes/changes.xml [utf-8] (original)
+++ commons/proper/lang/trunk/src/changes/changes.xml [utf-8] Sat Dec 13 02:00:18 2014
@@ -22,6 +22,7 @@
   <body>
 
   <release version="3.4" date="tba" description="tba">
+    <action issue="LANG-1077" type="fix" dev="kinow" due-to="haiyang li">StringUtils.ordinalIndexOf("aaaaaa",
"aa", 2) != 3 in StringUtils</action>
     <action issue="LANG-1072" type="fix" dev="sebb" due-to="haiyang li">Duplicated
"0x" check in createBigInteger in NumberUtils</action>
     <action issue="LANG-1064" type="fix" dev="djones" due-to="B.J. Herbison">StringUtils.abbreviate
description doesn't agree with the examples</action>
     <action issue="LANG-1052" type="add" dev="britter" due-to="Jan Matèrne">Multiline
recursive to string style</action>

Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java?rev=1645101&r1=1645100&r2=1645101&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java Sat
Dec 13 02:00:18 2014
@@ -1023,9 +1023,9 @@ public class StringUtils {
         int index = lastIndex ? str.length() : INDEX_NOT_FOUND;
         do {
             if (lastIndex) {
-                index = CharSequenceUtils.lastIndexOf(str, searchStr, index - 1);
+                index = CharSequenceUtils.lastIndexOf(str, searchStr, index - searchStr.length());
             } else {
-                index = CharSequenceUtils.indexOf(str, searchStr, index + 1);
+                index = CharSequenceUtils.indexOf(str, searchStr, index + searchStr.length());
             }
             if (index < 0) {
                 return index;

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java?rev=1645101&r1=1645100&r2=1645101&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
Sat Dec 13 02:00:18 2014
@@ -1006,6 +1006,9 @@ public class StringUtilsEqualsIndexOfTes
         assertEquals(7, StringUtils.ordinalIndexOf("aaaaaaaaa", "a", 8));
         assertEquals(8, StringUtils.ordinalIndexOf("aaaaaaaaa", "a", 9));
         assertEquals(-1, StringUtils.ordinalIndexOf("aaaaaaaaa", "a", 10));
+
+        assertEquals(3, StringUtils.ordinalIndexOf("aaaaaa", "aa", 2));
+        assertEquals(-1, StringUtils.ordinalIndexOf("aaaaaa", "aa", 3));
     }
 
 }



Mime
View raw message