mirror of https://github.com/apache/maven.git
[MNG-6829] Replace any StringUtils#isEmpty(String) and #isNotEmpty(String) (#1104)
* [MNG-6829] Replace any StringUtils#isEmpty(String) and #isNotEmpty(String) Use this link to re-run the recipe: https://public.moderne.io/recipes/org.openrewrite.java.migrate.apache.commons.lang.IsNotEmptyToJdk?organizationId=QXBhY2hlIE1hdmVu Co-authored-by: Moderne <team@moderne.io> * Apply Spotless --------- Co-authored-by: Moderne <team@moderne.io>
This commit is contained in:
parent
56674cdc90
commit
a8319821a9
|
@ -24,7 +24,6 @@ import org.codehaus.plexus.component.annotations.Component;
|
||||||
import org.codehaus.plexus.component.annotations.Requirement;
|
import org.codehaus.plexus.component.annotations.Requirement;
|
||||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
|
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
|
||||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
|
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describes runtime information about the application.
|
* Describes runtime information about the application.
|
||||||
|
@ -47,7 +46,7 @@ public class DefaultRuntimeInformation implements RuntimeInformation, Initializa
|
||||||
public void initialize() throws InitializationException {
|
public void initialize() throws InitializationException {
|
||||||
String mavenVersion = rtInfo.getMavenVersion();
|
String mavenVersion = rtInfo.getMavenVersion();
|
||||||
|
|
||||||
if (StringUtils.isEmpty(mavenVersion)) {
|
if (mavenVersion == null || mavenVersion.isEmpty()) {
|
||||||
throw new InitializationException("Unable to read Maven version from maven-core");
|
throw new InitializationException("Unable to read Maven version from maven-core");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class FileProfileActivator extends DetectedProfileActivator implements Lo
|
||||||
interpolator.addValueSource(new MapBasedValueSource(System.getProperties()));
|
interpolator.addValueSource(new MapBasedValueSource(System.getProperties()));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (StringUtils.isNotEmpty(fileString)) {
|
if (fileString != null && !fileString.isEmpty()) {
|
||||||
fileString = StringUtils.replace(interpolator.interpolate(fileString, ""), "\\", "/");
|
fileString = StringUtils.replace(interpolator.interpolate(fileString, ""), "\\", "/");
|
||||||
return FileUtils.fileExists(fileString);
|
return FileUtils.fileExists(fileString);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ public class FileProfileActivator extends DetectedProfileActivator implements Lo
|
||||||
// check if the file is missing, if it is then the profile will be active
|
// check if the file is missing, if it is then the profile will be active
|
||||||
fileString = actFile.getMissing();
|
fileString = actFile.getMissing();
|
||||||
|
|
||||||
if (StringUtils.isNotEmpty(fileString)) {
|
if (fileString != null && !fileString.isEmpty()) {
|
||||||
fileString = StringUtils.replace(interpolator.interpolate(fileString, ""), "\\", "/");
|
fileString = StringUtils.replace(interpolator.interpolate(fileString, ""), "\\", "/");
|
||||||
return !FileUtils.fileExists(fileString);
|
return !FileUtils.fileExists(fileString);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ import org.apache.maven.model.Profile;
|
||||||
import org.codehaus.plexus.context.Context;
|
import org.codehaus.plexus.context.Context;
|
||||||
import org.codehaus.plexus.context.ContextException;
|
import org.codehaus.plexus.context.ContextException;
|
||||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
|
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SystemPropertyProfileActivator
|
* SystemPropertyProfileActivator
|
||||||
|
@ -65,7 +64,7 @@ public class SystemPropertyProfileActivator extends DetectedProfileActivator imp
|
||||||
String sysValue = properties.getProperty(name);
|
String sysValue = properties.getProperty(name);
|
||||||
|
|
||||||
String propValue = property.getValue();
|
String propValue = property.getValue();
|
||||||
if (StringUtils.isNotEmpty(propValue)) {
|
if (propValue != null && !propValue.isEmpty()) {
|
||||||
boolean reverseValue = false;
|
boolean reverseValue = false;
|
||||||
if (propValue.startsWith("!")) {
|
if (propValue.startsWith("!")) {
|
||||||
reverseValue = true;
|
reverseValue = true;
|
||||||
|
@ -81,7 +80,7 @@ public class SystemPropertyProfileActivator extends DetectedProfileActivator imp
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
boolean result = StringUtils.isNotEmpty(sysValue);
|
boolean result = sysValue != null && !sysValue.isEmpty();
|
||||||
|
|
||||||
if (reverseName) {
|
if (reverseName) {
|
||||||
return !result;
|
return !result;
|
||||||
|
|
|
@ -26,7 +26,6 @@ import org.apache.maven.RepositoryUtils;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.settings.Mirror;
|
import org.apache.maven.settings.Mirror;
|
||||||
import org.codehaus.plexus.component.annotations.Component;
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DefaultMirrorSelector
|
* DefaultMirrorSelector
|
||||||
|
@ -173,7 +172,7 @@ public class DefaultMirrorSelector implements MirrorSelector {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
|
|
||||||
// simple checks first to short circuit processing below.
|
// simple checks first to short circuit processing below.
|
||||||
if (StringUtils.isEmpty(mirrorLayout) || WILDCARD.equals(mirrorLayout)) {
|
if ((mirrorLayout == null || mirrorLayout.isEmpty()) || WILDCARD.equals(mirrorLayout)) {
|
||||||
result = true;
|
result = true;
|
||||||
} else if (mirrorLayout.equals(repoLayout)) {
|
} else if (mirrorLayout.equals(repoLayout)) {
|
||||||
result = true;
|
result = true;
|
||||||
|
|
|
@ -191,7 +191,7 @@ public class LegacyRepositorySystem implements RepositorySystem {
|
||||||
|
|
||||||
public Artifact createPluginArtifact(Plugin plugin) {
|
public Artifact createPluginArtifact(Plugin plugin) {
|
||||||
String version = plugin.getVersion();
|
String version = plugin.getVersion();
|
||||||
if (StringUtils.isEmpty(version)) {
|
if (version == null || version.isEmpty()) {
|
||||||
version = "RELEASE";
|
version = "RELEASE";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -683,13 +683,13 @@ public class LegacyRepositorySystem implements RepositorySystem {
|
||||||
if (repo != null) {
|
if (repo != null) {
|
||||||
String id = repo.getId();
|
String id = repo.getId();
|
||||||
|
|
||||||
if (StringUtils.isEmpty(id)) {
|
if (id == null || id.isEmpty()) {
|
||||||
throw new InvalidRepositoryException("Repository identifier missing", "");
|
throw new InvalidRepositoryException("Repository identifier missing", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
String url = repo.getUrl();
|
String url = repo.getUrl();
|
||||||
|
|
||||||
if (StringUtils.isEmpty(url)) {
|
if (url == null || url.isEmpty()) {
|
||||||
throw new InvalidRepositoryException("URL missing for repository " + id, id);
|
throw new InvalidRepositoryException("URL missing for repository " + id, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -738,7 +738,7 @@ public class LegacyRepositorySystem implements RepositorySystem {
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
String msg = error.getMessage();
|
String msg = error.getMessage();
|
||||||
if (StringUtils.isNotEmpty(msg)) {
|
if (msg != null && !msg.isEmpty()) {
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
return getMessage(error.getCause(), def);
|
return getMessage(error.getCause(), def);
|
||||||
|
|
|
@ -145,7 +145,7 @@ public class MavenRepositorySystem {
|
||||||
VersionRange versionRange;
|
VersionRange versionRange;
|
||||||
try {
|
try {
|
||||||
String version = plugin.getVersion();
|
String version = plugin.getVersion();
|
||||||
if (StringUtils.isEmpty(version)) {
|
if (version == null || version.isEmpty()) {
|
||||||
version = "RELEASE";
|
version = "RELEASE";
|
||||||
}
|
}
|
||||||
versionRange = VersionRange.createFromVersionSpec(version);
|
versionRange = VersionRange.createFromVersionSpec(version);
|
||||||
|
@ -323,13 +323,13 @@ public class MavenRepositorySystem {
|
||||||
if (repo != null) {
|
if (repo != null) {
|
||||||
String id = repo.getId();
|
String id = repo.getId();
|
||||||
|
|
||||||
if (StringUtils.isEmpty(id)) {
|
if (id == null || id.isEmpty()) {
|
||||||
throw new InvalidRepositoryException("Repository identifier missing", "");
|
throw new InvalidRepositoryException("Repository identifier missing", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
String url = repo.getUrl();
|
String url = repo.getUrl();
|
||||||
|
|
||||||
if (StringUtils.isEmpty(url)) {
|
if (url == null || url.isEmpty()) {
|
||||||
throw new InvalidRepositoryException("URL missing for repository " + id, id);
|
throw new InvalidRepositoryException("URL missing for repository " + id, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -787,7 +787,7 @@ public class MavenRepositorySystem {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
|
|
||||||
// simple checks first to short circuit processing below.
|
// simple checks first to short circuit processing below.
|
||||||
if (StringUtils.isEmpty(mirrorLayout) || WILDCARD.equals(mirrorLayout)) {
|
if ((mirrorLayout == null || mirrorLayout.isEmpty()) || WILDCARD.equals(mirrorLayout)) {
|
||||||
result = true;
|
result = true;
|
||||||
} else if (mirrorLayout.equals(repoLayout)) {
|
} else if (mirrorLayout.equals(repoLayout)) {
|
||||||
result = true;
|
result = true;
|
||||||
|
|
|
@ -44,7 +44,6 @@ import org.codehaus.plexus.PlexusContainer;
|
||||||
import org.codehaus.plexus.classworlds.ClassWorld;
|
import org.codehaus.plexus.classworlds.ClassWorld;
|
||||||
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
||||||
import org.codehaus.plexus.classworlds.realm.DuplicateRealmException;
|
import org.codehaus.plexus.classworlds.realm.DuplicateRealmException;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
|
||||||
import org.eclipse.aether.artifact.Artifact;
|
import org.eclipse.aether.artifact.Artifact;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -272,7 +271,7 @@ public class DefaultClassRealmManager implements ClassRealmManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getId(String gid, String aid, String type, String cls, String ver) {
|
private static String getId(String gid, String aid, String type, String cls, String ver) {
|
||||||
return gid + ':' + aid + ':' + type + (StringUtils.isNotEmpty(cls) ? ':' + cls : "") + ':' + ver;
|
return gid + ':' + aid + ':' + type + ((cls != null && !cls.isEmpty()) ? ':' + cls : "") + ':' + ver;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void callDelegates(
|
private void callDelegates(
|
||||||
|
|
|
@ -37,7 +37,6 @@ import org.apache.maven.plugin.PluginContainerException;
|
||||||
import org.apache.maven.plugin.PluginExecutionException;
|
import org.apache.maven.plugin.PluginExecutionException;
|
||||||
import org.apache.maven.project.ProjectBuildingException;
|
import org.apache.maven.project.ProjectBuildingException;
|
||||||
import org.apache.maven.project.ProjectBuildingResult;
|
import org.apache.maven.project.ProjectBuildingResult;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
@ -190,11 +189,11 @@ public class DefaultExceptionHandler implements ExceptionHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isEmpty(reference)) {
|
if (reference == null || reference.isEmpty()) {
|
||||||
reference = getReference(cause);
|
reference = getReference(cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isEmpty(reference)) {
|
if (reference == null || reference.isEmpty()) {
|
||||||
reference = exception.getClass().getSimpleName();
|
reference = exception.getClass().getSimpleName();
|
||||||
}
|
}
|
||||||
} else if (exception instanceof LifecycleExecutionException) {
|
} else if (exception instanceof LifecycleExecutionException) {
|
||||||
|
@ -204,7 +203,7 @@ public class DefaultExceptionHandler implements ExceptionHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isNotEmpty(reference) && !reference.startsWith("http:")) {
|
if ((reference != null && !reference.isEmpty()) && !reference.startsWith("http:")) {
|
||||||
reference = "http://cwiki.apache.org/confluence/display/MAVEN/" + reference;
|
reference = "http://cwiki.apache.org/confluence/display/MAVEN/" + reference;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,8 +230,9 @@ public class DefaultExceptionHandler implements ExceptionHandler {
|
||||||
|
|
||||||
if (t instanceof AbstractMojoExecutionException) {
|
if (t instanceof AbstractMojoExecutionException) {
|
||||||
String longMessage = ((AbstractMojoExecutionException) t).getLongMessage();
|
String longMessage = ((AbstractMojoExecutionException) t).getLongMessage();
|
||||||
if (StringUtils.isNotEmpty(longMessage)) {
|
if (longMessage != null && !longMessage.isEmpty()) {
|
||||||
if (StringUtils.isEmpty(exceptionMessage) || longMessage.contains(exceptionMessage)) {
|
if ((exceptionMessage == null || exceptionMessage.isEmpty())
|
||||||
|
|| longMessage.contains(exceptionMessage)) {
|
||||||
exceptionMessage = longMessage;
|
exceptionMessage = longMessage;
|
||||||
} else if (!exceptionMessage.contains(longMessage)) {
|
} else if (!exceptionMessage.contains(longMessage)) {
|
||||||
exceptionMessage = join(exceptionMessage, System.lineSeparator() + longMessage);
|
exceptionMessage = join(exceptionMessage, System.lineSeparator() + longMessage);
|
||||||
|
@ -240,7 +240,7 @@ public class DefaultExceptionHandler implements ExceptionHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isEmpty(exceptionMessage)) {
|
if (exceptionMessage == null || exceptionMessage.isEmpty()) {
|
||||||
exceptionMessage = t.getClass().getSimpleName();
|
exceptionMessage = t.getClass().getSimpleName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,12 +257,12 @@ public class DefaultExceptionHandler implements ExceptionHandler {
|
||||||
private String join(String message1, String message2) {
|
private String join(String message1, String message2) {
|
||||||
String message = "";
|
String message = "";
|
||||||
|
|
||||||
if (StringUtils.isNotEmpty(message1)) {
|
if (message1 != null && !message1.isEmpty()) {
|
||||||
message = message1.trim();
|
message = message1.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isNotEmpty(message2)) {
|
if (message2 != null && !message2.isEmpty()) {
|
||||||
if (StringUtils.isNotEmpty(message)) {
|
if (message != null && !message.isEmpty()) {
|
||||||
if (message.endsWith(".") || message.endsWith("!") || message.endsWith(":")) {
|
if (message.endsWith(".") || message.endsWith("!") || message.endsWith(":")) {
|
||||||
message += " ";
|
message += " ";
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -41,7 +41,6 @@ import org.apache.maven.settings.Settings;
|
||||||
import org.apache.maven.settings.SettingsUtils;
|
import org.apache.maven.settings.SettingsUtils;
|
||||||
import org.apache.maven.toolchain.model.PersistedToolchains;
|
import org.apache.maven.toolchain.model.PersistedToolchains;
|
||||||
import org.apache.maven.toolchain.model.ToolchainModel;
|
import org.apache.maven.toolchain.model.ToolchainModel;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assists in populating an execution request for invocation of Maven.
|
* Assists in populating an execution request for invocation of Maven.
|
||||||
|
@ -157,7 +156,7 @@ public class DefaultMavenExecutionRequestPopulator implements MavenExecutionRequ
|
||||||
localRepositoryPath = request.getLocalRepositoryPath().getAbsolutePath();
|
localRepositoryPath = request.getLocalRepositoryPath().getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isEmpty(localRepositoryPath)) {
|
if (localRepositoryPath == null || localRepositoryPath.isEmpty()) {
|
||||||
localRepositoryPath = RepositorySystem.defaultUserLocalRepository.getAbsolutePath();
|
localRepositoryPath = RepositorySystem.defaultUserLocalRepository.getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -266,7 +266,7 @@ public class DefaultGraphBuilder implements GraphBuilder {
|
||||||
boolean makeUpstream = makeBoth || MavenExecutionRequest.REACTOR_MAKE_UPSTREAM.equals(makeBehavior);
|
boolean makeUpstream = makeBoth || MavenExecutionRequest.REACTOR_MAKE_UPSTREAM.equals(makeBehavior);
|
||||||
boolean makeDownstream = makeBoth || MavenExecutionRequest.REACTOR_MAKE_DOWNSTREAM.equals(makeBehavior);
|
boolean makeDownstream = makeBoth || MavenExecutionRequest.REACTOR_MAKE_DOWNSTREAM.equals(makeBehavior);
|
||||||
|
|
||||||
if (StringUtils.isNotEmpty(makeBehavior) && !makeUpstream && !makeDownstream) {
|
if ((makeBehavior != null && !makeBehavior.isEmpty()) && !makeUpstream && !makeDownstream) {
|
||||||
throw new MavenExecutionException("Invalid reactor make behavior: " + makeBehavior, request.getPom());
|
throw new MavenExecutionException("Invalid reactor make behavior: " + makeBehavior, request.getPom());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -454,7 +454,7 @@ public class DefaultLifecycleExecutionPlanCalculator implements LifecycleExecuti
|
||||||
|
|
||||||
String forkedLifecycle = mojoDescriptor.getExecuteLifecycle();
|
String forkedLifecycle = mojoDescriptor.getExecuteLifecycle();
|
||||||
|
|
||||||
if (StringUtils.isEmpty(forkedLifecycle)) {
|
if (forkedLifecycle == null || forkedLifecycle.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@ import org.apache.maven.plugin.descriptor.Parameter;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.maven.shared.utils.logging.MessageBuilder;
|
import org.apache.maven.shared.utils.logging.MessageBuilder;
|
||||||
import org.apache.maven.shared.utils.logging.MessageUtils;
|
import org.apache.maven.shared.utils.logging.MessageUtils;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -98,7 +97,7 @@ public class DefaultMojoExecutionConfigurator implements MojoExecutionConfigurat
|
||||||
}
|
}
|
||||||
|
|
||||||
private PluginExecution findPluginExecution(String executionId, Collection<PluginExecution> executions) {
|
private PluginExecution findPluginExecution(String executionId, Collection<PluginExecution> executions) {
|
||||||
if (StringUtils.isNotEmpty(executionId)) {
|
if (executionId != null && !executionId.isEmpty()) {
|
||||||
for (PluginExecution execution : executions) {
|
for (PluginExecution execution : executions) {
|
||||||
if (executionId.equals(execution.getId())) {
|
if (executionId.equals(execution.getId())) {
|
||||||
return execution;
|
return execution;
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.apache.maven.lifecycle.internal.builder.BuilderCommon;
|
||||||
import org.apache.maven.plugin.MojoExecution;
|
import org.apache.maven.plugin.MojoExecution;
|
||||||
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -137,12 +136,12 @@ public class LifecycleDebugLogger {
|
||||||
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
|
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
|
||||||
|
|
||||||
String scopeToCollect = mojoDescriptor.getDependencyCollectionRequired();
|
String scopeToCollect = mojoDescriptor.getDependencyCollectionRequired();
|
||||||
if (StringUtils.isNotEmpty(scopeToCollect)) {
|
if (scopeToCollect != null && !scopeToCollect.isEmpty()) {
|
||||||
scopesToCollect.add(scopeToCollect);
|
scopesToCollect.add(scopeToCollect);
|
||||||
}
|
}
|
||||||
|
|
||||||
String scopeToResolve = mojoDescriptor.getDependencyResolutionRequired();
|
String scopeToResolve = mojoDescriptor.getDependencyResolutionRequired();
|
||||||
if (StringUtils.isNotEmpty(scopeToResolve)) {
|
if (scopeToResolve != null && !scopeToResolve.isEmpty()) {
|
||||||
scopesToResolve.add(scopeToResolve);
|
scopesToResolve.add(scopeToResolve);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,6 @@ import org.apache.maven.plugin.PluginIncompatibleException;
|
||||||
import org.apache.maven.plugin.PluginManagerException;
|
import org.apache.maven.plugin.PluginManagerException;
|
||||||
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
|
||||||
import org.eclipse.aether.SessionData;
|
import org.eclipse.aether.SessionData;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -126,7 +125,7 @@ public class MojoExecutor {
|
||||||
private Collection<String> toScopes(String classpath) {
|
private Collection<String> toScopes(String classpath) {
|
||||||
Collection<String> scopes = Collections.emptyList();
|
Collection<String> scopes = Collections.emptyList();
|
||||||
|
|
||||||
if (StringUtils.isNotEmpty(classpath)) {
|
if (classpath != null && !classpath.isEmpty()) {
|
||||||
if (Artifact.SCOPE_COMPILE.equals(classpath)) {
|
if (Artifact.SCOPE_COMPILE.equals(classpath)) {
|
||||||
scopes = Arrays.asList(Artifact.SCOPE_COMPILE, Artifact.SCOPE_SYSTEM, Artifact.SCOPE_PROVIDED);
|
scopes = Arrays.asList(Artifact.SCOPE_COMPILE, Artifact.SCOPE_SYSTEM, Artifact.SCOPE_PROVIDED);
|
||||||
} else if (Artifact.SCOPE_RUNTIME.equals(classpath)) {
|
} else if (Artifact.SCOPE_RUNTIME.equals(classpath)) {
|
||||||
|
@ -398,10 +397,10 @@ public class MojoExecutor {
|
||||||
String scopeToCollect = mojoDescriptor.getDependencyCollectionRequired();
|
String scopeToCollect = mojoDescriptor.getDependencyCollectionRequired();
|
||||||
|
|
||||||
List<String> scopes = new ArrayList<>(2);
|
List<String> scopes = new ArrayList<>(2);
|
||||||
if (StringUtils.isNotEmpty(scopeToCollect)) {
|
if (scopeToCollect != null && !scopeToCollect.isEmpty()) {
|
||||||
scopes.add(scopeToCollect);
|
scopes.add(scopeToCollect);
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotEmpty(scopeToResolve)) {
|
if (scopeToResolve != null && !scopeToResolve.isEmpty()) {
|
||||||
scopes.add(scopeToResolve);
|
scopes.add(scopeToResolve);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class LifecyclePhase {
|
||||||
public void set(String goals) {
|
public void set(String goals) {
|
||||||
mojos = new ArrayList<>();
|
mojos = new ArrayList<>();
|
||||||
|
|
||||||
if (StringUtils.isNotEmpty(goals)) {
|
if (goals != null && !goals.isEmpty()) {
|
||||||
String[] mojoGoals = StringUtils.split(goals, ",");
|
String[] mojoGoals = StringUtils.split(goals, ",");
|
||||||
|
|
||||||
for (String mojoGoal : mojoGoals) {
|
for (String mojoGoal : mojoGoals) {
|
||||||
|
|
|
@ -26,7 +26,6 @@ import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||||
import org.apache.maven.plugin.descriptor.Parameter;
|
import org.apache.maven.plugin.descriptor.Parameter;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PluginParameterException
|
* PluginParameterException
|
||||||
|
@ -123,7 +122,7 @@ public class PluginParameterException extends PluginConfigurationException {
|
||||||
messageBuffer.append("</configuration>");
|
messageBuffer.append("</configuration>");
|
||||||
|
|
||||||
String alias = param.getAlias();
|
String alias = param.getAlias();
|
||||||
if (StringUtils.isNotEmpty(alias) && !alias.equals(param.getName())) {
|
if ((alias != null && !alias.isEmpty()) && !alias.equals(param.getName())) {
|
||||||
messageBuffer.append(LS).append(LS).append("-OR-").append(LS).append(LS);
|
messageBuffer.append(LS).append(LS).append("-OR-").append(LS).append(LS);
|
||||||
messageBuffer
|
messageBuffer
|
||||||
.append("<configuration>")
|
.append("<configuration>")
|
||||||
|
@ -142,7 +141,7 @@ public class PluginParameterException extends PluginConfigurationException {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isEmpty(expression)) {
|
if (expression == null || expression.isEmpty()) {
|
||||||
messageBuffer.append('.');
|
messageBuffer.append('.');
|
||||||
} else {
|
} else {
|
||||||
if (param.isEditable()) {
|
if (param.isEditable()) {
|
||||||
|
|
|
@ -631,7 +631,7 @@ public class DefaultMavenPluginManager implements MavenPluginManager {
|
||||||
|
|
||||||
String configuratorId = mojoDescriptor.getComponentConfigurator();
|
String configuratorId = mojoDescriptor.getComponentConfigurator();
|
||||||
|
|
||||||
if (StringUtils.isEmpty(configuratorId)) {
|
if (configuratorId == null || configuratorId.isEmpty()) {
|
||||||
configuratorId = mojoDescriptor.isV4Api() ? "enhanced" : "basic";
|
configuratorId = mojoDescriptor.isV4Api() ? "enhanced" : "basic";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -169,10 +169,10 @@ public class DefaultPluginVersionResolver implements PluginVersionResolver {
|
||||||
String version = null;
|
String version = null;
|
||||||
ArtifactRepository repo = null;
|
ArtifactRepository repo = null;
|
||||||
|
|
||||||
if (StringUtils.isNotEmpty(versions.releaseVersion)) {
|
if (versions.releaseVersion != null && !versions.releaseVersion.isEmpty()) {
|
||||||
version = versions.releaseVersion;
|
version = versions.releaseVersion;
|
||||||
repo = versions.releaseRepository;
|
repo = versions.releaseRepository;
|
||||||
} else if (StringUtils.isNotEmpty(versions.latestVersion)) {
|
} else if (versions.latestVersion != null && !versions.latestVersion.isEmpty()) {
|
||||||
version = versions.latestVersion;
|
version = versions.latestVersion;
|
||||||
repo = versions.latestRepository;
|
repo = versions.latestRepository;
|
||||||
}
|
}
|
||||||
|
|
|
@ -492,7 +492,7 @@ public class DefaultProjectBuilder implements ProjectBuilder {
|
||||||
File basedir = pomFile.getParentFile();
|
File basedir = pomFile.getParentFile();
|
||||||
List<File> moduleFiles = new ArrayList<>();
|
List<File> moduleFiles = new ArrayList<>();
|
||||||
for (String module : model.getModules()) {
|
for (String module : model.getModules()) {
|
||||||
if (StringUtils.isEmpty(module)) {
|
if (module == null || module.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ import org.apache.maven.api.model.Extension;
|
||||||
import org.apache.maven.api.model.Parent;
|
import org.apache.maven.api.model.Parent;
|
||||||
import org.apache.maven.api.model.Plugin;
|
import org.apache.maven.api.model.Plugin;
|
||||||
import org.apache.maven.artifact.ArtifactUtils;
|
import org.apache.maven.artifact.ArtifactUtils;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
|
||||||
import org.codehaus.plexus.util.dag.CycleDetectedException;
|
import org.codehaus.plexus.util.dag.CycleDetectedException;
|
||||||
import org.codehaus.plexus.util.dag.DAG;
|
import org.codehaus.plexus.util.dag.DAG;
|
||||||
import org.codehaus.plexus.util.dag.TopologicalSorter;
|
import org.codehaus.plexus.util.dag.TopologicalSorter;
|
||||||
|
@ -245,7 +244,7 @@ public class ProjectSorter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isSpecificVersion(String version) {
|
private boolean isSpecificVersion(String version) {
|
||||||
return !(StringUtils.isEmpty(version) || version.startsWith("[") || version.startsWith("("));
|
return !((version == null || version.isEmpty()) || version.startsWith("[") || version.startsWith("("));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO !![jc; 28-jul-2005] check this; if we're using '-r' and there are aggregator tasks, this will result in
|
// TODO !![jc; 28-jul-2005] check this; if we're using '-r' and there are aggregator tasks, this will result in
|
||||||
|
|
|
@ -34,7 +34,6 @@ import org.apache.maven.project.ProjectBuilder;
|
||||||
import org.apache.maven.project.ProjectBuildingException;
|
import org.apache.maven.project.ProjectBuildingException;
|
||||||
import org.apache.maven.project.ProjectBuildingRequest;
|
import org.apache.maven.project.ProjectBuildingRequest;
|
||||||
import org.apache.maven.project.ProjectBuildingResult;
|
import org.apache.maven.project.ProjectBuildingResult;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -76,7 +75,7 @@ public class DefaultProjectsSelector implements ProjectsSelector {
|
||||||
|
|
||||||
for (ModelProblem problem : result.getProblems()) {
|
for (ModelProblem problem : result.getProblems()) {
|
||||||
String loc = ModelProblemUtils.formatLocation(problem, result.getProjectId());
|
String loc = ModelProblemUtils.formatLocation(problem, result.getProjectId());
|
||||||
LOGGER.warn("{}{}", problem.getMessage(), (StringUtils.isNotEmpty(loc) ? " @ " + loc : ""));
|
LOGGER.warn("{}{}", problem.getMessage(), ((loc != null && !loc.isEmpty()) ? " @ " + loc : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
problems = true;
|
problems = true;
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.apache.maven.settings.building.SettingsBuilder;
|
||||||
import org.apache.maven.settings.building.SettingsBuildingException;
|
import org.apache.maven.settings.building.SettingsBuildingException;
|
||||||
import org.apache.maven.settings.building.SettingsBuildingRequest;
|
import org.apache.maven.settings.building.SettingsBuildingRequest;
|
||||||
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
|
||||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -111,7 +110,7 @@ public class DefaultMavenSettingsBuilder extends AbstractLogEnabled implements M
|
||||||
|
|
||||||
String path = System.getProperty(altLocationSysProp);
|
String path = System.getProperty(altLocationSysProp);
|
||||||
|
|
||||||
if (StringUtils.isEmpty(path)) {
|
if (path == null || path.isEmpty()) {
|
||||||
// TODO This replacing shouldn't be necessary as user.home should be in the
|
// TODO This replacing shouldn't be necessary as user.home should be in the
|
||||||
// context of the container and thus the value would be interpolated by Plexus
|
// context of the container and thus the value would be interpolated by Plexus
|
||||||
String basedir = System.getProperty(basedirSysProp);
|
String basedir = System.getProperty(basedirSysProp);
|
||||||
|
|
|
@ -47,7 +47,6 @@ import org.apache.maven.project.collector.MultiModuleCollectionStrategy;
|
||||||
import org.apache.maven.project.collector.PomlessCollectionStrategy;
|
import org.apache.maven.project.collector.PomlessCollectionStrategy;
|
||||||
import org.apache.maven.project.collector.ProjectsSelector;
|
import org.apache.maven.project.collector.ProjectsSelector;
|
||||||
import org.apache.maven.project.collector.RequestPomCollectionStrategy;
|
import org.apache.maven.project.collector.RequestPomCollectionStrategy;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
import org.junit.jupiter.params.provider.Arguments;
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
|
@ -299,7 +298,7 @@ class DefaultGraphBuilderTest {
|
||||||
when(mavenExecutionRequest.getMakeBehavior()).thenReturn(parameterMakeBehavior);
|
when(mavenExecutionRequest.getMakeBehavior()).thenReturn(parameterMakeBehavior);
|
||||||
when(mavenExecutionRequest.getPom()).thenReturn(parameterRequestedPom);
|
when(mavenExecutionRequest.getPom()).thenReturn(parameterRequestedPom);
|
||||||
when(mavenExecutionRequest.isRecursive()).thenReturn(parameterRecursive);
|
when(mavenExecutionRequest.isRecursive()).thenReturn(parameterRecursive);
|
||||||
if (StringUtils.isNotEmpty(parameterResumeFrom)) {
|
if (parameterResumeFrom != null && !parameterResumeFrom.isEmpty()) {
|
||||||
when(mavenExecutionRequest.getResumeFrom()).thenReturn(":" + parameterResumeFrom);
|
when(mavenExecutionRequest.getResumeFrom()).thenReturn(":" + parameterResumeFrom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,6 @@ import org.apache.maven.repository.RepositorySystem;
|
||||||
import org.apache.maven.settings.Mirror;
|
import org.apache.maven.settings.Mirror;
|
||||||
import org.apache.maven.settings.Proxy;
|
import org.apache.maven.settings.Proxy;
|
||||||
import org.apache.maven.settings.Server;
|
import org.apache.maven.settings.Server;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
|
||||||
import org.eclipse.aether.RepositorySystemSession;
|
import org.eclipse.aether.RepositorySystemSession;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -156,7 +155,7 @@ public class TestRepositorySystem implements RepositorySystem {
|
||||||
VersionRange versionRange;
|
VersionRange versionRange;
|
||||||
try {
|
try {
|
||||||
String version = plugin.getVersion();
|
String version = plugin.getVersion();
|
||||||
if (StringUtils.isEmpty(version)) {
|
if (version == null || version.isEmpty()) {
|
||||||
version = "RELEASE";
|
version = "RELEASE";
|
||||||
}
|
}
|
||||||
versionRange = VersionRange.createFromVersionSpec(version);
|
versionRange = VersionRange.createFromVersionSpec(version);
|
||||||
|
|
|
@ -28,7 +28,6 @@ import org.apache.commons.jxpath.ri.compiler.NodeTypeTest;
|
||||||
import org.apache.commons.jxpath.ri.model.NodeIterator;
|
import org.apache.commons.jxpath.ri.model.NodeIterator;
|
||||||
import org.apache.commons.jxpath.ri.model.NodePointer;
|
import org.apache.commons.jxpath.ri.model.NodePointer;
|
||||||
import org.apache.maven.api.xml.XmlNode;
|
import org.apache.maven.api.xml.XmlNode;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
|
||||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -106,7 +105,7 @@ class Xpp3DomNodeIterator implements NodeIterator {
|
||||||
}
|
}
|
||||||
if (test instanceof NodeNameTest) {
|
if (test instanceof NodeNameTest) {
|
||||||
String nodeName = node.getName();
|
String nodeName = node.getName();
|
||||||
if (StringUtils.isEmpty(nodeName)) {
|
if (nodeName == null || nodeName.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +118,7 @@ class Xpp3DomNodeIterator implements NodeIterator {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (wildcard || testName.equals(nodeName)) {
|
if (wildcard || testName.equals(nodeName)) {
|
||||||
return StringUtils.isEmpty(namespaceURI) || StringUtils.isEmpty(testPrefix);
|
return (namespaceURI == null || namespaceURI.isEmpty()) || (testPrefix == null || testPrefix.isEmpty());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -846,7 +846,7 @@ public class MavenCli {
|
||||||
|
|
||||||
List<File> jars = new ArrayList<>();
|
List<File> jars = new ArrayList<>();
|
||||||
|
|
||||||
if (StringUtils.isNotEmpty(extClassPath)) {
|
if (extClassPath != null && !extClassPath.isEmpty()) {
|
||||||
for (String jar : StringUtils.split(extClassPath, File.pathSeparator)) {
|
for (String jar : StringUtils.split(extClassPath, File.pathSeparator)) {
|
||||||
File file = resolveFile(new File(jar), cliRequest.workingDirectory);
|
File file = resolveFile(new File(jar), cliRequest.workingDirectory);
|
||||||
|
|
||||||
|
@ -1055,7 +1055,7 @@ public class MavenCli {
|
||||||
|
|
||||||
String msg = summary.getMessage();
|
String msg = summary.getMessage();
|
||||||
|
|
||||||
if (StringUtils.isNotEmpty(referenceKey)) {
|
if (referenceKey != null && !referenceKey.isEmpty()) {
|
||||||
if (msg.indexOf('\n') < 0) {
|
if (msg.indexOf('\n') < 0) {
|
||||||
msg += " -> " + buffer().strong(referenceKey);
|
msg += " -> " + buffer().strong(referenceKey);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -421,7 +421,7 @@ public class ExecutionEventLogger extends AbstractExecutionListener {
|
||||||
|
|
||||||
private void append(MessageBuilder buffer, MojoExecution me) {
|
private void append(MessageBuilder buffer, MojoExecution me) {
|
||||||
String prefix = me.getMojoDescriptor().getPluginDescriptor().getGoalPrefix();
|
String prefix = me.getMojoDescriptor().getPluginDescriptor().getGoalPrefix();
|
||||||
if (StringUtils.isEmpty(prefix)) {
|
if (prefix == null || prefix.isEmpty()) {
|
||||||
prefix = me.getGroupId() + ":" + me.getArtifactId();
|
prefix = me.getGroupId() + ":" + me.getArtifactId();
|
||||||
}
|
}
|
||||||
buffer.mojo(prefix + ':' + me.getVersion() + ':' + me.getGoal());
|
buffer.mojo(prefix + ':' + me.getVersion() + ':' + me.getGoal());
|
||||||
|
|
|
@ -29,7 +29,6 @@ import org.apache.maven.model.building.ModelProblem.Version;
|
||||||
import org.apache.maven.model.building.ModelProblemCollector;
|
import org.apache.maven.model.building.ModelProblemCollector;
|
||||||
import org.apache.maven.model.building.ModelProblemCollectorRequest;
|
import org.apache.maven.model.building.ModelProblemCollectorRequest;
|
||||||
import org.apache.maven.model.profile.ProfileActivationContext;
|
import org.apache.maven.model.profile.ProfileActivationContext;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines profile activation based on the existence or value of some execution property.
|
* Determines profile activation based on the existence or value of some execution property.
|
||||||
|
@ -76,7 +75,7 @@ public class PropertyProfileActivator implements ProfileActivator {
|
||||||
}
|
}
|
||||||
|
|
||||||
String propValue = property.getValue();
|
String propValue = property.getValue();
|
||||||
if (StringUtils.isNotEmpty(propValue)) {
|
if (propValue != null && !propValue.isEmpty()) {
|
||||||
boolean reverseValue = false;
|
boolean reverseValue = false;
|
||||||
if (propValue.startsWith("!")) {
|
if (propValue.startsWith("!")) {
|
||||||
reverseValue = true;
|
reverseValue = true;
|
||||||
|
@ -86,7 +85,7 @@ public class PropertyProfileActivator implements ProfileActivator {
|
||||||
// we have a value, so it has to match the system value...
|
// we have a value, so it has to match the system value...
|
||||||
return reverseValue != propValue.equals(sysValue);
|
return reverseValue != propValue.equals(sysValue);
|
||||||
} else {
|
} else {
|
||||||
return reverseName != StringUtils.isNotEmpty(sysValue);
|
return reverseName != (sysValue != null && !sysValue.isEmpty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -606,7 +606,7 @@ public class DefaultModelValidator implements ModelValidator {
|
||||||
}
|
}
|
||||||
|
|
||||||
String sysPath = dependency.getSystemPath();
|
String sysPath = dependency.getSystemPath();
|
||||||
if (StringUtils.isNotEmpty(sysPath)) {
|
if (sysPath != null && !sysPath.isEmpty()) {
|
||||||
if (!hasExpression(sysPath)) {
|
if (!hasExpression(sysPath)) {
|
||||||
addViolation(
|
addViolation(
|
||||||
problems,
|
problems,
|
||||||
|
@ -837,7 +837,7 @@ public class DefaultModelValidator implements ModelValidator {
|
||||||
if ("system".equals(d.getScope())) {
|
if ("system".equals(d.getScope())) {
|
||||||
String systemPath = d.getSystemPath();
|
String systemPath = d.getSystemPath();
|
||||||
|
|
||||||
if (StringUtils.isEmpty(systemPath)) {
|
if (systemPath == null || systemPath.isEmpty()) {
|
||||||
addViolation(
|
addViolation(
|
||||||
problems,
|
problems,
|
||||||
Severity.ERROR,
|
Severity.ERROR,
|
||||||
|
|
Loading…
Reference in New Issue