Skip to content

Commit

Permalink
[MNG-6829] Replace StringUtils#isEmpty(String) and #isNotEmpty(String) (
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek and TeamModerne authored May 22, 2023
1 parent 6f72300 commit 19ea1a8
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 96 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -478,9 +478,9 @@ protected String getArtifactType(MavenProject p) {
* @return the list of source paths for the given project.
*/
protected List<String> getProjectSourceRoots(MavenProject p) {
return (p.getCompileSourceRoots() == null
return p.getCompileSourceRoots() == null
? Collections.<String>emptyList()
: new LinkedList<>(p.getCompileSourceRoots()));
: new LinkedList<>(p.getCompileSourceRoots());
}

/**
Expand All @@ -490,9 +490,9 @@ protected List<String> getProjectSourceRoots(MavenProject p) {
* if any
*/
protected List<String> getCompileClasspathElements(MavenProject p) throws DependencyResolutionRequiredException {
return (p.getCompileClasspathElements() == null
return p.getCompileClasspathElements() == null
? Collections.<String>emptyList()
: new LinkedList<>(p.getCompileClasspathElements()));
: new LinkedList<>(p.getCompileClasspathElements());
}

/**
Expand All @@ -512,7 +512,7 @@ protected static String getJavaMethodAsString(JavaExecutable javaExecutable) {
*/
private void init() {
// defaultAuthor
if (StringUtils.isEmpty(defaultAuthor)) {
if (defaultAuthor == null || defaultAuthor.isEmpty()) {
defaultAuthor = System.getProperty("user.name");
}

Expand Down Expand Up @@ -550,7 +550,7 @@ private void init() {
fixTagsSplitted = StringUtils.split(fixTags, ",");

// encoding
if (StringUtils.isEmpty(encoding)) {
if (encoding == null || encoding.isEmpty()) {
if (getLog().isWarnEnabled()) {
getLog().warn("File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING
+ ", i.e. build is platform dependent!");
Expand Down Expand Up @@ -1027,7 +1027,7 @@ private void takeCareSingleComment(

String javadocComment = trimRight(extractOriginalJavadoc(originalContent, entity));
String extraComment = javadocComment.substring(javadocComment.indexOf(END_JAVADOC) + END_JAVADOC.length());
if (StringUtils.isNotEmpty(extraComment)) {
if (extraComment != null && !extraComment.isEmpty()) {
if (extraComment.contains(EOL)) {
stringWriter.write(extraComment.substring(extraComment.indexOf(EOL) + EOL.length()));
} else {
Expand Down Expand Up @@ -1082,7 +1082,7 @@ private boolean isInLevel(List<String> modifiers) {
}

if (LEVEL_PROTECTED.equalsIgnoreCase(level.trim())) {
return (modifiers.contains(LEVEL_PUBLIC) || modifiers.contains(LEVEL_PROTECTED));
return modifiers.contains(LEVEL_PUBLIC) || modifiers.contains(LEVEL_PROTECTED);
}

if (LEVEL_PACKAGE.equalsIgnoreCase(level.trim())) {
Expand Down Expand Up @@ -1887,7 +1887,7 @@ private void writeReturnTag(
return;
}

if (StringUtils.isNotEmpty(originalJavadocTag)
if ((originalJavadocTag != null && !originalJavadocTag.isEmpty())
&& javaMethod.getReturns() != null
&& !javaMethod.getReturns().isVoid()) {
sb.append(originalJavadocTag);
Expand Down Expand Up @@ -3044,7 +3044,7 @@ private static String alignIndentationJavadocLines(final String content, final S
* @return the indentation for the given line.
*/
private static String autodetectIndentation(final String line) {
if (StringUtils.isEmpty(line)) {
if (line == null || line.isEmpty()) {
return "";
}

Expand Down Expand Up @@ -3084,7 +3084,7 @@ private static String[] getLines(final String content) throws IOException {
* @return the text trimmed on left side or empty if text is null.
*/
private static String trimLeft(final String text) {
if (StringUtils.isEmpty(text) || StringUtils.isEmpty(text.trim())) {
if ((text == null || text.isEmpty()) || StringUtils.isEmpty(text.trim())) {
return "";
}

Expand All @@ -3106,7 +3106,7 @@ private static String trimLeft(final String text) {
* @return the text trimmed on tight side or empty if text is null.
*/
private static String trimRight(final String text) {
if (StringUtils.isEmpty(text) || StringUtils.isEmpty(text.trim())) {
if ((text == null || text.isEmpty()) || StringUtils.isEmpty(text.trim())) {
return "";
}

Expand Down
Loading

0 comments on commit 19ea1a8

Please # to comment.