From 3f4c4f49abccc2b4172c6d9d04697115ab6500eb Mon Sep 17 00:00:00 2001 From: NoctisSolvane Date: Sun, 22 Mar 2026 22:03:18 +0530 Subject: [PATCH 1/3] Improve Javadoc for StringUtils.isBlank (closes apache/commons-lang#1234) --- .../org/apache/commons/lang3/StringUtils.java | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java index 02d32f8a091..9496879cae9 100644 --- a/src/main/java/org/apache/commons/lang3/StringUtils.java +++ b/src/main/java/org/apache/commons/lang3/StringUtils.java @@ -3497,21 +3497,29 @@ public static boolean isAsciiPrintable(final CharSequence cs) { } /** - * Tests if a CharSequence is empty ({@code "")}, null, or contains only whitespace as defined by {@link Character#isWhitespace(char)}. - * - *
-     * StringUtils.isBlank(null)      = true
-     * StringUtils.isBlank("")        = true
-     * StringUtils.isBlank(" ")       = true
-     * StringUtils.isBlank("bob")     = false
-     * StringUtils.isBlank("  bob  ") = false
-     * 
- * - * @param cs the CharSequence to check, may be null. - * @return {@code true} if the CharSequence is null, empty or whitespace only. - * @since 2.0 - * @since 3.0 Changed signature from isBlank(String) to isBlank(CharSequence) - */ + * Checks if a CharSequence is empty (""), null, or consists only of whitespace characters. + *

+ * Whitespace is determined by {@link Character#isWhitespace(char)}. + *

+ *

+ * Examples: + *

+ * StringUtils.isBlank(null)      = true
+ * StringUtils.isBlank("")        = true
+ * StringUtils.isBlank(" ")       = true
+ * StringUtils.isBlank("\t\n\r")  = true
+ * StringUtils.isBlank("bob")     = false
+ * StringUtils.isBlank("  bob  ") = false
+ * 
+ *

+ *

+ * NOTE: This differs from {@link #isEmpty(CharSequence)} which does not check for whitespace. + *

+ * + * @param cs the CharSequence to check, may be null + * @return {@code true} if the CharSequence is empty, null or whitespace only + * @since 3.0 + */ public static boolean isBlank(final CharSequence cs) { final int strLen = length(cs); for (int i = 0; i < strLen; i++) { From 13507ea0c88ffad46f123d1ba57ec7e660cfce61 Mon Sep 17 00:00:00 2001 From: NoctisSolvane Date: Mon, 23 Mar 2026 09:12:14 +0530 Subject: [PATCH 2/3] Removed the @since tag which would probably confuse history and wasn't needed while mantaining the other changes --- src/main/java/org/apache/commons/lang3/StringUtils.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java index 9496879cae9..3e1e52ba654 100644 --- a/src/main/java/org/apache/commons/lang3/StringUtils.java +++ b/src/main/java/org/apache/commons/lang3/StringUtils.java @@ -3518,7 +3518,6 @@ public static boolean isAsciiPrintable(final CharSequence cs) { * * @param cs the CharSequence to check, may be null * @return {@code true} if the CharSequence is empty, null or whitespace only - * @since 3.0 */ public static boolean isBlank(final CharSequence cs) { final int strLen = length(cs); From 74405e2077639e07a16baa2e8690f0e921a1fca9 Mon Sep 17 00:00:00 2001 From: NoctisSolvane Date: Tue, 24 Mar 2026 09:39:14 +0530 Subject: [PATCH 3/3] Simplify JavaDoc improvement for isBlank based on review feedback --- .../org/apache/commons/lang3/StringUtils.java | 30 +++++-------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java index 3e1e52ba654..bcdae3a7e37 100644 --- a/src/main/java/org/apache/commons/lang3/StringUtils.java +++ b/src/main/java/org/apache/commons/lang3/StringUtils.java @@ -3497,28 +3497,14 @@ public static boolean isAsciiPrintable(final CharSequence cs) { } /** - * Checks if a CharSequence is empty (""), null, or consists only of whitespace characters. - *

- * Whitespace is determined by {@link Character#isWhitespace(char)}. - *

- *

- * Examples: - *

- * StringUtils.isBlank(null)      = true
- * StringUtils.isBlank("")        = true
- * StringUtils.isBlank(" ")       = true
- * StringUtils.isBlank("\t\n\r")  = true
- * StringUtils.isBlank("bob")     = false
- * StringUtils.isBlank("  bob  ") = false
- * 
- *

- *

- * NOTE: This differs from {@link #isEmpty(CharSequence)} which does not check for whitespace. - *

- * - * @param cs the CharSequence to check, may be null - * @return {@code true} if the CharSequence is empty, null or whitespace only - */ + * Checks if a CharSequence is empty(""), null or whitespace only. + *

+ * Whitespace is determined by {@link Charachter#isWhiteSpace(char)} + *

+ * + * @param cs the CharSequence to check, may be null + * @return {@code true} if the CharSequence is empty, null or whitespace only + */ public static boolean isBlank(final CharSequence cs) { final int strLen = length(cs); for (int i = 0; i < strLen; i++) {