From d6d311e69092061358fc7fc63b5a1a03db915512 Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Fri, 10 Mar 2023 13:02:00 -0500 Subject: [PATCH 1/3] deprecate questionable utility methods --- .../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 1b2f1b66..0f946cd9 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 @@ -404,18 +404,28 @@ private PrettyPrintXMLWriter getPrettyPrintXMLWriter( StringWriter writer ) } /** - * @param str The string to be checked. - * @return true if the string is not empty (length > 0) and not null. + * 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 null + * @deprecated use str != null && !str.isEmpty() */ + @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 null. + * 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 null + * @deprecated use str == null || str.trim().isEmpty() */ + @Deprecated public static boolean isEmpty( String str ) { return str == null || str.trim().length() == 0; From b456e82d413a5e9c3a7501a8b08d39c76f82cd58 Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Fri, 10 Mar 2023 13:04:45 -0500 Subject: [PATCH 2/3] fix javadoc --- src/main/java/org/apache/maven/shared/utils/xml/Xpp3Dom.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 0f946cd9..85cfb8bf 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 @@ -404,7 +404,7 @@ private PrettyPrintXMLWriter getPrettyPrintXMLWriter( StringWriter writer ) } /** - * Warning: this is not the reverse of {@link #isEmpty()}. + * 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 From 7164f5f838d0830ea6c7612ad2fbc48812d8179a Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Fri, 10 Mar 2023 13:05:38 -0500 Subject: [PATCH 3/3] fix javadoc --- src/main/java/org/apache/maven/shared/utils/xml/Xpp3Dom.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 85cfb8bf..bbd0c2b7 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 @@ -409,7 +409,7 @@ private PrettyPrintXMLWriter getPrettyPrintXMLWriter( StringWriter writer ) * * @param str the string to be checked * @return true if the string is not empty (length > 0) and not null - * @deprecated use str != null && !str.isEmpty() + * @deprecated use str != null && !str.isEmpty() */ @Deprecated public static boolean isNotEmpty( String str )