This is an automated email from the ASF dual-hosted git repository. elharo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-shared-utils.git
The following commit(s) were added to refs/heads/master by this push: new 259b796 [MNG-7729] deprecate questionable IsEmpty/IsNotEmpty methods (#136) 259b796 is described below commit 259b796b2ae9f32de25eef5aeb87204cc446f514 Author: Elliotte Rusty Harold <elh...@users.noreply.github.com> AuthorDate: Fri Apr 28 11:06:13 2023 -0400 [MNG-7729] deprecate questionable IsEmpty/IsNotEmpty methods (#136) * deprecate questionable utility methods --- .../org/apache/maven/shared/utils/xml/Xpp3Dom.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/apache/maven/shared/utils/xml/Xpp3Dom.java b/src/main/java/org/apache/maven/shared/utils/xml/Xpp3Dom.java index 40b7b63..aece764 100644 --- a/src/main/java/org/apache/maven/shared/utils/xml/Xpp3Dom.java +++ b/src/main/java/org/apache/maven/shared/utils/xml/Xpp3Dom.java @@ -354,17 +354,27 @@ public class Xpp3Dom implements Iterable<Xpp3Dom> { } /** - * @param str The string to be checked. - * @return true if the string is not empty (length > 0) and not <code>null</code>. + * Warning: this is not the reverse of {@link #isEmpty}. + * Whitespace only strings are both empty and not empty. + * + * @param str the string to be checked + * @return true if the string is not empty (length > 0) and not <code>null</code> + * @deprecated use <code>str != null && !str.isEmpty()</code> */ + @Deprecated public static boolean isNotEmpty(String str) { return str != null && str.length() > 0; } /** - * @param str The string to be checked. - * @return true if the string is empty or <code>null</code>. + * Warning: this is not the reverse of {@link #isNotEmpty}. + * Whitespace only strings are both empty and not empty. + * + * @param str the string to be checked + * @return true if the string only contains whitespace or is <code>null</code> + * @deprecated use <code>str == null || str.trim().isEmpty()</code> */ + @Deprecated public static boolean isEmpty(String str) { return str == null || str.trim().length() == 0; }