commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject [lang] [LANG-1191] Incorrect Javadoc StringUtils.containsAny(CharSequence, CharSequence...).
Date Tue, 26 Jan 2016 18:51:30 GMT
Repository: commons-lang
Updated Branches:
  refs/heads/master 04a5d83ae -> 3af7d0dac


[LANG-1191] Incorrect Javadoc StringUtils.containsAny(CharSequence,
CharSequence...).

Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/3af7d0da
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/3af7d0da
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/3af7d0da

Branch: refs/heads/master
Commit: 3af7d0dace7bee3f42b88abcaca853765cee3557
Parents: 04a5d83
Author: ggregory <ggregory@apache.org>
Authored: Tue Jan 26 10:51:27 2016 -0800
Committer: ggregory <ggregory@apache.org>
Committed: Tue Jan 26 10:51:27 2016 -0800

----------------------------------------------------------------------
 src/changes/changes.xml                                       | 1 +
 src/main/java/org/apache/commons/lang3/StringUtils.java       | 7 ++++---
 .../apache/commons/lang3/StringUtilsEqualsIndexOfTest.java    | 4 ++++
 3 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3af7d0da/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 60092c7..3941311 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -75,6 +75,7 @@
     <action issue="LANG-1162" type="fix" dev="sebb">StringUtils#equals fails with Index
OOBE on non-Strings with identical leading prefix</action>
     <action issue="LANG-1163" type="fix" dev="sebb">There are no tests for CharSequenceUtils.regionMatches</action>
     <action issue="LANG-1200" type="fix" dev="ggregory" due-to="BarkZhang">[GitHub
PR] modify note at line 1230 #120</action>
+    <action issue="LANG-1191" type="fix" dev="ggregory" due-to="qed, Brent Worden, Gary
Gregory">Incorrect Javadoc StringUtils.containsAny(CharSequence, CharSequence...)</action>
   </release>
 
   <release version="3.4" date="2014-04-06" description="Feature and bugfix release">

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3af7d0da/src/main/java/org/apache/commons/lang3/StringUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index a0b5e52..c59aeb4 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -1935,7 +1935,7 @@ public class StringUtils {
      * <p>Checks if the CharSequence contains any of the CharSequences in the given
array.</p>
      *
      * <p>
-     * A {@code null} CharSequence will return {@code false}. A {@code null} or zero
+     * A {@code null} {@code cs} CharSequence will return {@code false}. A {@code null} or
zero
      * length search array will return {@code false}.
      * </p>
      *
@@ -1944,14 +1944,15 @@ public class StringUtils {
      * StringUtils.containsAny("", *)              = false
      * StringUtils.containsAny(*, null)            = false
      * StringUtils.containsAny(*, [])              = false
-     * StringUtils.containsAny("abcd", "ab", null) = false
+     * StringUtils.containsAny("abcd", "ab", null) = true
      * StringUtils.containsAny("abcd", "ab", "cd") = true
      * StringUtils.containsAny("abc", "d", "abc")  = true
      * </pre>
      *
      * 
      * @param cs The CharSequence to check, may be null
-     * @param searchCharSequences The array of CharSequences to search for, may be null
+     * @param searchCharSequences The array of CharSequences to search for, may be null.
+     * Individual CharSequences may be null as well.
      * @return {@code true} if any of the search CharSequences are found, {@code false} otherwise
      * @since 3.4
      */

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/3af7d0da/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
index 4f9d743..6ffc1b2 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
@@ -236,6 +236,10 @@ public class StringUtilsEqualsIndexOfTest  {
         assertFalse(StringUtils.containsAny("hello, goodbye", new String[]{"Hello", "Goodbye"}));
         assertFalse(StringUtils.containsAny("hello, goodbye", new String[]{"Hello", null}));
         assertFalse(StringUtils.containsAny("hello, null", new String[] { "Hello", null }));
+        // Javadoc examples:
+        assertTrue(StringUtils.containsAny("abcd", "ab", null));
+        assertTrue(StringUtils.containsAny("abcd", "ab", "cd"));
+        assertTrue(StringUtils.containsAny("abc", "d", "abc"));
     }
 
     @SystemDefaults(locale="de_DE")


Mime
View raw message