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-6829] Replace StringUtils#isEmpty(String) and #isNotEmpty(String) #154

Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -429,21 +429,21 @@ public static ProxyInfo getProxyInfo(Repository repository, WagonManager wagonMa
String nonProxyHostPrefix = nonProxyHost.substring(0, pos);
String nonProxyHostSuffix = nonProxyHost.substring(pos + 1);
// prefix*
if (StringUtils.isNotEmpty(nonProxyHostPrefix)
if ((nonProxyHostPrefix != null && !nonProxyHostPrefix.isEmpty())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null checks aren't needed here. substring never returns null.

&& host.startsWith(nonProxyHostPrefix)
&& StringUtils.isEmpty(nonProxyHostSuffix)) {
&& (nonProxyHostSuffix == null || nonProxyHostSuffix.isEmpty())) {
return null;
}
// *suffix
if (StringUtils.isEmpty(nonProxyHostPrefix)
&& StringUtils.isNotEmpty(nonProxyHostSuffix)
if ((nonProxyHostPrefix == null || nonProxyHostPrefix.isEmpty())
&& (nonProxyHostSuffix != null && !nonProxyHostSuffix.isEmpty())
&& host.endsWith(nonProxyHostSuffix)) {
return null;
}
// prefix*suffix
if (StringUtils.isNotEmpty(nonProxyHostPrefix)
if ((nonProxyHostPrefix != null && !nonProxyHostPrefix.isEmpty())
&& host.startsWith(nonProxyHostPrefix)
&& StringUtils.isNotEmpty(nonProxyHostSuffix)
&& (nonProxyHostSuffix != null && !nonProxyHostSuffix.isEmpty())
&& host.endsWith(nonProxyHostSuffix)) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package org.apache.maven.plugins.site.deploy;

import org.apache.commons.lang3.StringUtils;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
Expand Down Expand Up @@ -51,7 +50,7 @@ public abstract class AbstractStagingMojo extends AbstractDeployMojo {
*/
@Override
protected String determineTopDistributionManagementSiteUrl() throws MojoExecutionException {
if (StringUtils.isEmpty(topSiteURL)) {
if (topSiteURL == null || topSiteURL.isEmpty()) {
MavenProject topProject = getTopLevelProject(project);
String url = getSite(topProject).getUrl();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.apache.maven.model.Build;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginManagement;
Expand Down Expand Up @@ -89,13 +88,13 @@ protected boolean isDeploy() {
*/
@Override
protected String determineTopDistributionManagementSiteUrl() throws MojoExecutionException {
if (StringUtils.isNotEmpty(topSiteURL)) {
if (topSiteURL != null && !topSiteURL.isEmpty()) {
getLog().debug("stage-deploy top distributionManagement.site.url configured with topSiteURL parameter: "
+ topSiteURL);
return topSiteURL;
}

if (StringUtils.isNotEmpty(stagingSiteURL)) {
if (stagingSiteURL != null && !stagingSiteURL.isEmpty()) {
// We need to calculate the first project that supplied same stagingSiteURL
MavenProject topProject = getTopMostParentWithSameStagingSiteURL();
String url = getSite(topProject).getUrl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.util.Locale;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.apache.maven.archiver.MavenArchiver;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.doxia.site.Menu;
Expand Down Expand Up @@ -175,7 +174,7 @@ public abstract class AbstractSiteRenderingMojo extends AbstractSiteDescriptorMo
* @return The input files encoding, never <code>null</code>.
*/
protected String getInputEncoding() {
return (StringUtils.isEmpty(inputEncoding)) ? ReaderFactory.FILE_ENCODING : inputEncoding;
return (inputEncoding == null || inputEncoding.isEmpty()) ? ReaderFactory.FILE_ENCODING : inputEncoding;
}

/**
Expand All @@ -197,7 +196,7 @@ protected String getOutputEncoding() {
private boolean saveProcessedContent;

protected void checkInputEncoding() {
if (StringUtils.isEmpty(inputEncoding)) {
if (inputEncoding == null || inputEncoding.isEmpty()) {
getLog().warn("Input file encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING
+ ", i.e. build is platform dependent!");
}
Expand Down