commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henri Yandell <flame...@gmail.com>
Subject Re: [lang]
Date Sun, 07 Nov 2010 07:16:10 GMT
Thanks Dirk, I've gone ahead and fixed this in r1032220.

Index: src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
===================================================================
--- src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java	(revision
1031447)
+++ src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java	(working
copy)
@@ -596,7 +596,9 @@
         assertEquals(-1, StringUtils.indexOfAnyBut("zzabyycdxx", new char[0]));
         assertEquals(3, StringUtils.indexOfAnyBut("zzabyycdxx", new
char[] {'z','a'}));
         assertEquals(0, StringUtils.indexOfAnyBut("zzabyycdxx", new
char[] {'b','y'}));
-        assertEquals(0, StringUtils.indexOfAnyBut("ab", new char[] {'z'}));
+        assertEquals(-1, StringUtils.indexOfAnyBut("aba", new char[]
{'a', 'b'}));
+        assertEquals(0, StringUtils.indexOfAnyBut("aba", new char[] {'z'}));
+
     }

     public void testIndexOfAnyBut_StringCharArrayWithSupplementaryChars() {
Index: src/main/java/org/apache/commons/lang3/StringUtils.java
===================================================================
--- src/main/java/org/apache/commons/lang3/StringUtils.java	(revision 1031447)
+++ src/main/java/org/apache/commons/lang3/StringUtils.java	(working copy)
@@ -1555,13 +1555,14 @@
      * A <code>null</code> or zero length search array will return
<code>-1</code>.</p>
      *
      * <pre>
-     * StringUtils.indexOfAnyBut(null, *)           = -1
-     * StringUtils.indexOfAnyBut("", *)             = -1
-     * StringUtils.indexOfAnyBut(*, null)           = -1
-     * StringUtils.indexOfAnyBut(*, [])             = -1
-     * StringUtils.indexOfAnyBut("zzabyycdxx",'za') = 3
-     * StringUtils.indexOfAnyBut("zzabyycdxx", '')  = 0
-     * StringUtils.indexOfAnyBut("aba", 'ab')       = -1
+     * StringUtils.indexOfAnyBut(null, *)                              = -1
+     * StringUtils.indexOfAnyBut("", *)                                = -1
+     * StringUtils.indexOfAnyBut(*, null)                              = -1
+     * StringUtils.indexOfAnyBut(*, [])                                = -1
+     * StringUtils.indexOfAnyBut("zzabyycdxx", new char[] {'z', 'a'} ) = 3
+     * StringUtils.indexOfAnyBut("aba", new char[] {'z'} )             = 0
+     * StringUtils.indexOfAnyBut("aba", new char[] {'a', 'b'} )        = -1
+
      * </pre>
      *
      * @param cs  the CharSequence to check, may be null


On Wed, Oct 27, 2010 at 3:13 PM, Niall Pemberton
<niall.pemberton@gmail.com> wrote:
> On Wed, Oct 27, 2010 at 2:32 PM, Dirk Starke <Dirk.Starke@protagen.de> wrote:
>> Hello,
>>
>> I just recognized the following example in class StringUtils:
>>
>> StringUtils.indexOfAnyBut("zzabyycdxx", '')  = 0
>>
>> I don't understand this example, because [] is used for an empty array
>> in the documentation of this method. Could this be corrected or
>> explained?
>
> Looks like an error, should be:
>
> StringUtils.indexOfAnyBut("zzabyycdxx", "")   = -1
>
> http://commons.apache.org/lang/xref/org/apache/commons/lang3/StringUtils.html#1596
>
> Please file a bug report:
>
> http://commons.apache.org/lang/issue-tracking.html
>
> Thanks
>
> Niall
>
>>
>> Cheers,
>>
>> Dirk
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message