Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNG-7729] deprecate questionable IsEmpty/IsNotEmpty methods #136

Merged
merged 4 commits into from
Apr 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/main/java/org/apache/maven/shared/utils/xml/Xpp3Dom.java
Original file line number Diff line number Diff line change
Expand Up @@ -354,17 +354,27 @@ private PrettyPrintXMLWriter getPrettyPrintXMLWriter(StringWriter writer) {
}

/**
* @param str The string to be checked.
* @return true if the string is not empty (length &gt; 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 &gt; 0) and not <code>null</code>
* @deprecated use <code>str != null &amp;&amp; !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;
}
Expand Down