This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git

commit 347ab6ed4154849e375ce1daa477041c4fdd09df
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Tue Nov 17 04:26:23 2026 +0000

    Replace remaining StringUtils and Commons calls with the JDK
---
 .../maven/plugins/javadoc/AbstractJavadocMojo.java | 81 ++++++++++++++--------
 1 file changed, 51 insertions(+), 30 deletions(-)

diff --git 
a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java 
b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
index 4ad212db..22c9fcfc 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
@@ -2841,9 +2841,12 @@ public abstract class AbstractJavadocMojo extends 
AbstractMojo {
 
         List<String> bootclassPath = new ArrayList<>();
         for (BootclasspathArtifact aBootclasspathArtifact : 
bootclasspathArtifacts) {
-            if ((StringUtils.isNotEmpty(aBootclasspathArtifact.getGroupId()))
-                    && 
(StringUtils.isNotEmpty(aBootclasspathArtifact.getArtifactId()))
-                    && 
(StringUtils.isNotEmpty(aBootclasspathArtifact.getVersion()))) {
+            if ((aBootclasspathArtifact.getGroupId() != null
+                            && !aBootclasspathArtifact.getGroupId().isEmpty())
+                    && (aBootclasspathArtifact.getArtifactId() != null
+                            && 
!aBootclasspathArtifact.getArtifactId().isEmpty())
+                    && (aBootclasspathArtifact.getVersion() != null
+                            && 
!aBootclasspathArtifact.getVersion().isEmpty())) {
                 
bootclassPath.addAll(getArtifactsAbsolutePath(aBootclasspathArtifact));
             }
         }
@@ -2910,9 +2913,12 @@ public abstract class AbstractJavadocMojo extends 
AbstractMojo {
             return true;
         }
 
-        return StringUtils.isEmpty(aDocletArtifact.getGroupId())
-                && StringUtils.isEmpty(aDocletArtifact.getArtifactId())
-                && StringUtils.isEmpty(aDocletArtifact.getVersion());
+        return (aDocletArtifact.getGroupId() == null
+                        || aDocletArtifact.getGroupId().isEmpty())
+                && (aDocletArtifact.getArtifactId() == null
+                        || aDocletArtifact.getArtifactId().isEmpty())
+                && (aDocletArtifact.getVersion() == null
+                        || aDocletArtifact.getVersion().isEmpty());
     }
 
     /**
@@ -2929,9 +2935,12 @@ public abstract class AbstractJavadocMojo extends 
AbstractMojo {
 
         for (TagletArtifact tagletArtifact : tArtifacts) {
             if ((tagletArtifact != null)
-                    && (StringUtils.isNotEmpty(tagletArtifact.getGroupId()))
-                    && (StringUtils.isNotEmpty(tagletArtifact.getArtifactId()))
-                    && (StringUtils.isNotEmpty(tagletArtifact.getVersion()))) {
+                    && (tagletArtifact.getGroupId() != null
+                            && !tagletArtifact.getGroupId().isEmpty())
+                    && (tagletArtifact.getArtifactId() != null
+                            && !tagletArtifact.getArtifactId().isEmpty())
+                    && (tagletArtifact.getVersion() != null
+                            && !tagletArtifact.getVersion().isEmpty())) {
                 pathParts.addAll(getArtifactsAbsolutePath(tagletArtifact));
             }
         }
@@ -2947,7 +2956,7 @@ public abstract class AbstractJavadocMojo extends 
AbstractMojo {
                     && 
(StringUtils.isNotEmpty(taglet.getTagletArtifact().getArtifactId()))
                     && 
(StringUtils.isNotEmpty(taglet.getTagletArtifact().getVersion()))) {
                 
pathParts.addAll(JavadocUtil.pruneFiles(getArtifactsAbsolutePath(taglet.getTagletArtifact())));
-            } else if (StringUtils.isNotEmpty(taglet.getTagletpath())) {
+            } else if (taglet.getTagletpath() != null && 
!taglet.getTagletpath().isEmpty()) {
                 for (Path path :
                         JavadocUtil.prunePaths(project, 
Collections.singletonList(taglet.getTagletpath()), true)) {
                     pathParts.add(path.toString());
@@ -2955,7 +2964,7 @@ public abstract class AbstractJavadocMojo extends 
AbstractMojo {
             }
         }
 
-        if (StringUtils.isNotEmpty(tagletpath)) {
+        if (tagletpath != null && !tagletpath.isEmpty()) {
             pathParts.addAll(Arrays.asList(JavadocUtil.splitPath(tagletpath)));
         }
 
@@ -3237,9 +3246,12 @@ public abstract class AbstractJavadocMojo extends 
AbstractMojo {
      * @throws MavenReportException if any
      */
     private List<String> getArtifactsAbsolutePath(JavadocPathArtifact 
javadocArtifact) throws MavenReportException {
-        if ((StringUtils.isEmpty(javadocArtifact.getGroupId()))
-                && (StringUtils.isEmpty(javadocArtifact.getArtifactId()))
-                && (StringUtils.isEmpty(javadocArtifact.getVersion()))) {
+        if ((javadocArtifact.getGroupId() == null
+                        || javadocArtifact.getGroupId().isEmpty())
+                && (javadocArtifact.getArtifactId() == null
+                        || javadocArtifact.getArtifactId().isEmpty())
+                && (javadocArtifact.getVersion() == null
+                        || javadocArtifact.getVersion().isEmpty())) {
             return Collections.emptyList();
         }
 
@@ -3334,11 +3346,12 @@ public abstract class AbstractJavadocMojo extends 
AbstractMojo {
 
         if (activeProxies.containsKey("https")) {
             Proxy httpsProxy = activeProxies.get("https");
-            if (StringUtils.isNotEmpty(httpsProxy.getHost())) {
+            if (httpsProxy.getHost() != null && 
!httpsProxy.getHost().isEmpty()) {
                 cmd.createArg().setValue("-J-Dhttps.proxyHost=" + 
httpsProxy.getHost());
                 cmd.createArg().setValue("-J-Dhttps.proxyPort=" + 
httpsProxy.getPort());
 
-                if (StringUtils.isNotEmpty(httpsProxy.getNonProxyHosts())
+                if ((httpsProxy.getNonProxyHosts() != null
+                                && !httpsProxy.getNonProxyHosts().isEmpty())
                         && (!activeProxies.containsKey("http")
                                 || 
StringUtils.isEmpty(activeProxies.get("http").getNonProxyHosts()))) {
                     cmd.createArg()
@@ -3350,7 +3363,7 @@ public abstract class AbstractJavadocMojo extends 
AbstractMojo {
 
         if (activeProxies.containsKey("http")) {
             Proxy httpProxy = activeProxies.get("http");
-            if (StringUtils.isNotEmpty(httpProxy.getHost())) {
+            if (httpProxy.getHost() != null && !httpProxy.getHost().isEmpty()) 
{
                 cmd.createArg().setValue("-J-Dhttp.proxyHost=" + 
httpProxy.getHost());
                 cmd.createArg().setValue("-J-Dhttp.proxyPort=" + 
httpProxy.getPort());
 
@@ -3359,7 +3372,8 @@ public abstract class AbstractJavadocMojo extends 
AbstractMojo {
                     cmd.createArg().setValue("-J-Dhttps.proxyPort=" + 
httpProxy.getPort());
                 }
 
-                if (StringUtils.isNotEmpty(httpProxy.getNonProxyHosts())) {
+                if (httpProxy.getNonProxyHosts() != null
+                        && !httpProxy.getNonProxyHosts().isEmpty()) {
                     cmd.createArg()
                             .setValue("-J-Dhttp.nonProxyHosts=\""
                                     + 
httpProxy.getNonProxyHosts().replace("|", "^|") + "\"");
@@ -4169,7 +4183,7 @@ public abstract class AbstractJavadocMojo extends 
AbstractMojo {
         }
 
         // locale
-        if (StringUtils.isNotEmpty(this.locale)) {
+        if (this.locale != null && !this.locale.isEmpty()) {
             this.locale = siteTool.getSiteLocales(locale).get(0).toString();
         }
     }
@@ -4725,7 +4739,9 @@ public abstract class AbstractJavadocMojo extends 
AbstractMojo {
         }
 
         for (Group group : groups) {
-            if (group == null || StringUtils.isEmpty(group.getTitle()) || 
StringUtils.isEmpty(group.getPackages())) {
+            if (group == null
+                    || (group.getTitle() == null || group.getTitle().isEmpty())
+                    || (group.getPackages() == null || 
group.getPackages().isEmpty())) {
                 if (getLog().isWarnEnabled()) {
                     getLog().warn("A group option is empty. Ignore this 
option.");
                 }
@@ -4755,15 +4771,15 @@ public abstract class AbstractJavadocMojo extends 
AbstractMojo {
         }
 
         for (Tag tag : collectTags()) {
-            if (StringUtils.isEmpty(tag.getName())) {
+            if (tag.getName() == null || tag.getName().isEmpty()) {
                 if (getLog().isWarnEnabled()) {
                     getLog().warn("A tag name is empty. Ignore this option.");
                 }
             } else {
                 String value = "\"" + tag.getName();
-                if (StringUtils.isNotEmpty(tag.getPlacement())) {
+                if (tag.getPlacement() != null && 
!tag.getPlacement().isEmpty()) {
                     value += ":" + tag.getPlacement().replaceAll("\\R", 
lineSeparator);
-                    if (StringUtils.isNotEmpty(tag.getHead())) {
+                    if (tag.getHead() != null && !tag.getHead().isEmpty()) {
                         value += ":" + tag.getHead().replaceAll("\\R", 
lineSeparator);
                     }
                 }
@@ -4784,7 +4800,9 @@ public abstract class AbstractJavadocMojo extends 
AbstractMojo {
         }
 
         for (Taglet taglet1 : taglets) {
-            if ((taglet1 == null) || 
(StringUtils.isEmpty(taglet1.getTagletClass()))) {
+            if ((taglet1 == null)
+                    || (taglet1.getTagletClass() == null
+                            || taglet1.getTagletClass().isEmpty())) {
                 if (getLog().isWarnEnabled()) {
                     getLog().warn("A taglet option is empty. Ignore this 
option.");
                 }
@@ -4832,9 +4850,12 @@ public abstract class AbstractJavadocMojo extends 
AbstractMojo {
         List<String> tagletsPath = new ArrayList<>();
 
         for (TagletArtifact aTagletArtifact : tArtifacts) {
-            if ((StringUtils.isNotEmpty(aTagletArtifact.getGroupId()))
-                    && 
(StringUtils.isNotEmpty(aTagletArtifact.getArtifactId()))
-                    && (StringUtils.isNotEmpty(aTagletArtifact.getVersion()))) 
{
+            if ((aTagletArtifact.getGroupId() != null
+                            && !aTagletArtifact.getGroupId().isEmpty())
+                    && (aTagletArtifact.getArtifactId() != null
+                            && !aTagletArtifact.getArtifactId().isEmpty())
+                    && (aTagletArtifact.getVersion() != null
+                            && !aTagletArtifact.getVersion().isEmpty())) {
                 Artifact artifact;
                 try {
                     artifact = createAndResolveArtifact(aTagletArtifact);
@@ -4982,7 +5003,7 @@ public abstract class AbstractJavadocMojo extends 
AbstractMojo {
         try {
             int exitCode = CommandLineUtils.executeCommandLine(cmd, out, err);
 
-            String output = StringUtils.isEmpty(out.getOutput())
+            String output = out.getOutput() == null || 
out.getOutput().isEmpty()
                     ? null
                     : '\n' + out.getOutput().trim();
 
@@ -4993,7 +5014,7 @@ public abstract class AbstractJavadocMojo extends 
AbstractMojo {
                 writeDebugJavadocScript(cmdLine, javadocOutputDirectory);
 
                 if ((output != null && !output.isEmpty())
-                        && StringUtils.isEmpty(err.getOutput())
+                        && (err.getOutput() == null || 
err.getOutput().isEmpty())
                         && isJavadocVMInitError(output)) {
                     throw new MavenReportException(output + '\n' + '\n' + 
JavadocUtil.ERROR_INIT_VM + '\n'
                             + "Or, try to reduce the Java heap size for the 
Javadoc goal using "
@@ -5009,7 +5030,7 @@ public abstract class AbstractJavadocMojo extends 
AbstractMojo {
 
                 StringBuilder msg = new StringBuilder("\nExit code: ");
                 msg.append(exitCode);
-                if (StringUtils.isNotEmpty(err.getOutput())) {
+                if (err.getOutput() != null && !err.getOutput().isEmpty()) {
                     // parse stderr, log informational output, add all other 
to exception message
                     List<String> nonInfoLines = new ArrayList<>();
                     for (String str : err.getOutput().split("\\R")) {

Reply via email to