[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:
Tim te Beek 2023-05-10 00:46:02 +01:00 committed by GitHub
parent 56674cdc90
commit a8319821a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 55 additions and 71 deletions

View File

@ -24,7 +24,6 @@ import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
import org.codehaus.plexus.util.StringUtils;
/**
* Describes runtime information about the application.
@ -47,7 +46,7 @@ public class DefaultRuntimeInformation implements RuntimeInformation, Initializa
public void initialize() throws InitializationException {
String mavenVersion = rtInfo.getMavenVersion();
if (StringUtils.isEmpty(mavenVersion)) {
if (mavenVersion == null || mavenVersion.isEmpty()) {
throw new InitializationException("Unable to read Maven version from maven-core");
}

View File

@ -61,7 +61,7 @@ public class FileProfileActivator extends DetectedProfileActivator implements Lo
interpolator.addValueSource(new MapBasedValueSource(System.getProperties()));
try {
if (StringUtils.isNotEmpty(fileString)) {
if (fileString != null && !fileString.isEmpty()) {
fileString = StringUtils.replace(interpolator.interpolate(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
fileString = actFile.getMissing();
if (StringUtils.isNotEmpty(fileString)) {
if (fileString != null && !fileString.isEmpty()) {
fileString = StringUtils.replace(interpolator.interpolate(fileString, ""), "\\", "/");
return !FileUtils.fileExists(fileString);
}

View File

@ -26,7 +26,6 @@ import org.apache.maven.model.Profile;
import org.codehaus.plexus.context.Context;
import org.codehaus.plexus.context.ContextException;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
import org.codehaus.plexus.util.StringUtils;
/**
* SystemPropertyProfileActivator
@ -65,7 +64,7 @@ public class SystemPropertyProfileActivator extends DetectedProfileActivator imp
String sysValue = properties.getProperty(name);
String propValue = property.getValue();
if (StringUtils.isNotEmpty(propValue)) {
if (propValue != null && !propValue.isEmpty()) {
boolean reverseValue = false;
if (propValue.startsWith("!")) {
reverseValue = true;
@ -81,7 +80,7 @@ public class SystemPropertyProfileActivator extends DetectedProfileActivator imp
return result;
}
} else {
boolean result = StringUtils.isNotEmpty(sysValue);
boolean result = sysValue != null && !sysValue.isEmpty();
if (reverseName) {
return !result;

View File

@ -26,7 +26,6 @@ import org.apache.maven.RepositoryUtils;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.settings.Mirror;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.util.StringUtils;
/**
* DefaultMirrorSelector
@ -173,7 +172,7 @@ public class DefaultMirrorSelector implements MirrorSelector {
boolean result = false;
// 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;
} else if (mirrorLayout.equals(repoLayout)) {
result = true;

View File

@ -191,7 +191,7 @@ public class LegacyRepositorySystem implements RepositorySystem {
public Artifact createPluginArtifact(Plugin plugin) {
String version = plugin.getVersion();
if (StringUtils.isEmpty(version)) {
if (version == null || version.isEmpty()) {
version = "RELEASE";
}
@ -683,13 +683,13 @@ public class LegacyRepositorySystem implements RepositorySystem {
if (repo != null) {
String id = repo.getId();
if (StringUtils.isEmpty(id)) {
if (id == null || id.isEmpty()) {
throw new InvalidRepositoryException("Repository identifier missing", "");
}
String url = repo.getUrl();
if (StringUtils.isEmpty(url)) {
if (url == null || url.isEmpty()) {
throw new InvalidRepositoryException("URL missing for repository " + id, id);
}
@ -738,7 +738,7 @@ public class LegacyRepositorySystem implements RepositorySystem {
return def;
}
String msg = error.getMessage();
if (StringUtils.isNotEmpty(msg)) {
if (msg != null && !msg.isEmpty()) {
return msg;
}
return getMessage(error.getCause(), def);

View File

@ -145,7 +145,7 @@ public class MavenRepositorySystem {
VersionRange versionRange;
try {
String version = plugin.getVersion();
if (StringUtils.isEmpty(version)) {
if (version == null || version.isEmpty()) {
version = "RELEASE";
}
versionRange = VersionRange.createFromVersionSpec(version);
@ -323,13 +323,13 @@ public class MavenRepositorySystem {
if (repo != null) {
String id = repo.getId();
if (StringUtils.isEmpty(id)) {
if (id == null || id.isEmpty()) {
throw new InvalidRepositoryException("Repository identifier missing", "");
}
String url = repo.getUrl();
if (StringUtils.isEmpty(url)) {
if (url == null || url.isEmpty()) {
throw new InvalidRepositoryException("URL missing for repository " + id, id);
}
@ -787,7 +787,7 @@ public class MavenRepositorySystem {
boolean result = false;
// 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;
} else if (mirrorLayout.equals(repoLayout)) {
result = true;

View File

@ -44,7 +44,6 @@ import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.classworlds.ClassWorld;
import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.codehaus.plexus.classworlds.realm.DuplicateRealmException;
import org.codehaus.plexus.util.StringUtils;
import org.eclipse.aether.artifact.Artifact;
import org.slf4j.Logger;
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) {
return gid + ':' + aid + ':' + type + (StringUtils.isNotEmpty(cls) ? ':' + cls : "") + ':' + ver;
return gid + ':' + aid + ':' + type + ((cls != null && !cls.isEmpty()) ? ':' + cls : "") + ':' + ver;
}
private void callDelegates(

View File

@ -37,7 +37,6 @@ import org.apache.maven.plugin.PluginContainerException;
import org.apache.maven.plugin.PluginExecutionException;
import org.apache.maven.project.ProjectBuildingException;
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);
}
if (StringUtils.isEmpty(reference)) {
if (reference == null || reference.isEmpty()) {
reference = exception.getClass().getSimpleName();
}
} 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;
}
@ -231,8 +230,9 @@ public class DefaultExceptionHandler implements ExceptionHandler {
if (t instanceof AbstractMojoExecutionException) {
String longMessage = ((AbstractMojoExecutionException) t).getLongMessage();
if (StringUtils.isNotEmpty(longMessage)) {
if (StringUtils.isEmpty(exceptionMessage) || longMessage.contains(exceptionMessage)) {
if (longMessage != null && !longMessage.isEmpty()) {
if ((exceptionMessage == null || exceptionMessage.isEmpty())
|| longMessage.contains(exceptionMessage)) {
exceptionMessage = longMessage;
} else if (!exceptionMessage.contains(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();
}
@ -257,12 +257,12 @@ public class DefaultExceptionHandler implements ExceptionHandler {
private String join(String message1, String message2) {
String message = "";
if (StringUtils.isNotEmpty(message1)) {
if (message1 != null && !message1.isEmpty()) {
message = message1.trim();
}
if (StringUtils.isNotEmpty(message2)) {
if (StringUtils.isNotEmpty(message)) {
if (message2 != null && !message2.isEmpty()) {
if (message != null && !message.isEmpty()) {
if (message.endsWith(".") || message.endsWith("!") || message.endsWith(":")) {
message += " ";
} else {

View File

@ -41,7 +41,6 @@ import org.apache.maven.settings.Settings;
import org.apache.maven.settings.SettingsUtils;
import org.apache.maven.toolchain.model.PersistedToolchains;
import org.apache.maven.toolchain.model.ToolchainModel;
import org.codehaus.plexus.util.StringUtils;
/**
* Assists in populating an execution request for invocation of Maven.
@ -157,7 +156,7 @@ public class DefaultMavenExecutionRequestPopulator implements MavenExecutionRequ
localRepositoryPath = request.getLocalRepositoryPath().getAbsolutePath();
}
if (StringUtils.isEmpty(localRepositoryPath)) {
if (localRepositoryPath == null || localRepositoryPath.isEmpty()) {
localRepositoryPath = RepositorySystem.defaultUserLocalRepository.getAbsolutePath();
}

View File

@ -266,7 +266,7 @@ public class DefaultGraphBuilder implements GraphBuilder {
boolean makeUpstream = makeBoth || MavenExecutionRequest.REACTOR_MAKE_UPSTREAM.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());
}

View File

@ -454,7 +454,7 @@ public class DefaultLifecycleExecutionPlanCalculator implements LifecycleExecuti
String forkedLifecycle = mojoDescriptor.getExecuteLifecycle();
if (StringUtils.isEmpty(forkedLifecycle)) {
if (forkedLifecycle == null || forkedLifecycle.isEmpty()) {
return;
}

View File

@ -37,7 +37,6 @@ import org.apache.maven.plugin.descriptor.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.shared.utils.logging.MessageBuilder;
import org.apache.maven.shared.utils.logging.MessageUtils;
import org.codehaus.plexus.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -98,7 +97,7 @@ public class DefaultMojoExecutionConfigurator implements MojoExecutionConfigurat
}
private PluginExecution findPluginExecution(String executionId, Collection<PluginExecution> executions) {
if (StringUtils.isNotEmpty(executionId)) {
if (executionId != null && !executionId.isEmpty()) {
for (PluginExecution execution : executions) {
if (executionId.equals(execution.getId())) {
return execution;

View File

@ -32,7 +32,6 @@ import org.apache.maven.lifecycle.internal.builder.BuilderCommon;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -137,12 +136,12 @@ public class LifecycleDebugLogger {
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
String scopeToCollect = mojoDescriptor.getDependencyCollectionRequired();
if (StringUtils.isNotEmpty(scopeToCollect)) {
if (scopeToCollect != null && !scopeToCollect.isEmpty()) {
scopesToCollect.add(scopeToCollect);
}
String scopeToResolve = mojoDescriptor.getDependencyResolutionRequired();
if (StringUtils.isNotEmpty(scopeToResolve)) {
if (scopeToResolve != null && !scopeToResolve.isEmpty()) {
scopesToResolve.add(scopeToResolve);
}
}

View File

@ -56,7 +56,6 @@ import org.apache.maven.plugin.PluginIncompatibleException;
import org.apache.maven.plugin.PluginManagerException;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.StringUtils;
import org.eclipse.aether.SessionData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -126,7 +125,7 @@ public class MojoExecutor {
private Collection<String> toScopes(String classpath) {
Collection<String> scopes = Collections.emptyList();
if (StringUtils.isNotEmpty(classpath)) {
if (classpath != null && !classpath.isEmpty()) {
if (Artifact.SCOPE_COMPILE.equals(classpath)) {
scopes = Arrays.asList(Artifact.SCOPE_COMPILE, Artifact.SCOPE_SYSTEM, Artifact.SCOPE_PROVIDED);
} else if (Artifact.SCOPE_RUNTIME.equals(classpath)) {
@ -398,10 +397,10 @@ public class MojoExecutor {
String scopeToCollect = mojoDescriptor.getDependencyCollectionRequired();
List<String> scopes = new ArrayList<>(2);
if (StringUtils.isNotEmpty(scopeToCollect)) {
if (scopeToCollect != null && !scopeToCollect.isEmpty()) {
scopes.add(scopeToCollect);
}
if (StringUtils.isNotEmpty(scopeToResolve)) {
if (scopeToResolve != null && !scopeToResolve.isEmpty()) {
scopes.add(scopeToResolve);
}

View File

@ -52,7 +52,7 @@ public class LifecyclePhase {
public void set(String goals) {
mojos = new ArrayList<>();
if (StringUtils.isNotEmpty(goals)) {
if (goals != null && !goals.isEmpty()) {
String[] mojoGoals = StringUtils.split(goals, ",");
for (String mojoGoal : mojoGoals) {

View File

@ -26,7 +26,6 @@ import java.util.Properties;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.Parameter;
import org.codehaus.plexus.util.StringUtils;
/**
* PluginParameterException
@ -123,7 +122,7 @@ public class PluginParameterException extends PluginConfigurationException {
messageBuffer.append("</configuration>");
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("<configuration>")
@ -142,7 +141,7 @@ public class PluginParameterException extends PluginConfigurationException {
}
}
if (StringUtils.isEmpty(expression)) {
if (expression == null || expression.isEmpty()) {
messageBuffer.append('.');
} else {
if (param.isEditable()) {

View File

@ -631,7 +631,7 @@ public class DefaultMavenPluginManager implements MavenPluginManager {
String configuratorId = mojoDescriptor.getComponentConfigurator();
if (StringUtils.isEmpty(configuratorId)) {
if (configuratorId == null || configuratorId.isEmpty()) {
configuratorId = mojoDescriptor.isV4Api() ? "enhanced" : "basic";
}

View File

@ -169,10 +169,10 @@ public class DefaultPluginVersionResolver implements PluginVersionResolver {
String version = null;
ArtifactRepository repo = null;
if (StringUtils.isNotEmpty(versions.releaseVersion)) {
if (versions.releaseVersion != null && !versions.releaseVersion.isEmpty()) {
version = versions.releaseVersion;
repo = versions.releaseRepository;
} else if (StringUtils.isNotEmpty(versions.latestVersion)) {
} else if (versions.latestVersion != null && !versions.latestVersion.isEmpty()) {
version = versions.latestVersion;
repo = versions.latestRepository;
}

View File

@ -492,7 +492,7 @@ public class DefaultProjectBuilder implements ProjectBuilder {
File basedir = pomFile.getParentFile();
List<File> moduleFiles = new ArrayList<>();
for (String module : model.getModules()) {
if (StringUtils.isEmpty(module)) {
if (module == null || module.isEmpty()) {
continue;
}

View File

@ -31,7 +31,6 @@ import org.apache.maven.api.model.Extension;
import org.apache.maven.api.model.Parent;
import org.apache.maven.api.model.Plugin;
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.DAG;
import org.codehaus.plexus.util.dag.TopologicalSorter;
@ -245,7 +244,7 @@ public class ProjectSorter {
}
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

View File

@ -34,7 +34,6 @@ import org.apache.maven.project.ProjectBuilder;
import org.apache.maven.project.ProjectBuildingException;
import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.project.ProjectBuildingResult;
import org.codehaus.plexus.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -76,7 +75,7 @@ public class DefaultProjectsSelector implements ProjectsSelector {
for (ModelProblem problem : result.getProblems()) {
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;

View File

@ -32,7 +32,6 @@ import org.apache.maven.settings.building.SettingsBuilder;
import org.apache.maven.settings.building.SettingsBuildingException;
import org.apache.maven.settings.building.SettingsBuildingRequest;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
/**
@ -111,7 +110,7 @@ public class DefaultMavenSettingsBuilder extends AbstractLogEnabled implements M
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
// context of the container and thus the value would be interpolated by Plexus
String basedir = System.getProperty(basedirSysProp);

View File

@ -47,7 +47,6 @@ import org.apache.maven.project.collector.MultiModuleCollectionStrategy;
import org.apache.maven.project.collector.PomlessCollectionStrategy;
import org.apache.maven.project.collector.ProjectsSelector;
import org.apache.maven.project.collector.RequestPomCollectionStrategy;
import org.codehaus.plexus.util.StringUtils;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
@ -299,7 +298,7 @@ class DefaultGraphBuilderTest {
when(mavenExecutionRequest.getMakeBehavior()).thenReturn(parameterMakeBehavior);
when(mavenExecutionRequest.getPom()).thenReturn(parameterRequestedPom);
when(mavenExecutionRequest.isRecursive()).thenReturn(parameterRecursive);
if (StringUtils.isNotEmpty(parameterResumeFrom)) {
if (parameterResumeFrom != null && !parameterResumeFrom.isEmpty()) {
when(mavenExecutionRequest.getResumeFrom()).thenReturn(":" + parameterResumeFrom);
}

View File

@ -56,7 +56,6 @@ import org.apache.maven.repository.RepositorySystem;
import org.apache.maven.settings.Mirror;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Server;
import org.codehaus.plexus.util.StringUtils;
import org.eclipse.aether.RepositorySystemSession;
/**
@ -156,7 +155,7 @@ public class TestRepositorySystem implements RepositorySystem {
VersionRange versionRange;
try {
String version = plugin.getVersion();
if (StringUtils.isEmpty(version)) {
if (version == null || version.isEmpty()) {
version = "RELEASE";
}
versionRange = VersionRange.createFromVersionSpec(version);

View File

@ -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.NodePointer;
import org.apache.maven.api.xml.XmlNode;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.Xpp3Dom;
/**
@ -106,7 +105,7 @@ class Xpp3DomNodeIterator implements NodeIterator {
}
if (test instanceof NodeNameTest) {
String nodeName = node.getName();
if (StringUtils.isEmpty(nodeName)) {
if (nodeName == null || nodeName.isEmpty()) {
return false;
}
@ -119,7 +118,7 @@ class Xpp3DomNodeIterator implements NodeIterator {
return true;
}
if (wildcard || testName.equals(nodeName)) {
return StringUtils.isEmpty(namespaceURI) || StringUtils.isEmpty(testPrefix);
return (namespaceURI == null || namespaceURI.isEmpty()) || (testPrefix == null || testPrefix.isEmpty());
}
return false;
}

View File

@ -846,7 +846,7 @@ public class MavenCli {
List<File> jars = new ArrayList<>();
if (StringUtils.isNotEmpty(extClassPath)) {
if (extClassPath != null && !extClassPath.isEmpty()) {
for (String jar : StringUtils.split(extClassPath, File.pathSeparator)) {
File file = resolveFile(new File(jar), cliRequest.workingDirectory);
@ -1055,7 +1055,7 @@ public class MavenCli {
String msg = summary.getMessage();
if (StringUtils.isNotEmpty(referenceKey)) {
if (referenceKey != null && !referenceKey.isEmpty()) {
if (msg.indexOf('\n') < 0) {
msg += " -> " + buffer().strong(referenceKey);
} else {

View File

@ -421,7 +421,7 @@ public class ExecutionEventLogger extends AbstractExecutionListener {
private void append(MessageBuilder buffer, MojoExecution me) {
String prefix = me.getMojoDescriptor().getPluginDescriptor().getGoalPrefix();
if (StringUtils.isEmpty(prefix)) {
if (prefix == null || prefix.isEmpty()) {
prefix = me.getGroupId() + ":" + me.getArtifactId();
}
buffer.mojo(prefix + ':' + me.getVersion() + ':' + me.getGoal());

View File

@ -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.ModelProblemCollectorRequest;
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.
@ -76,7 +75,7 @@ public class PropertyProfileActivator implements ProfileActivator {
}
String propValue = property.getValue();
if (StringUtils.isNotEmpty(propValue)) {
if (propValue != null && !propValue.isEmpty()) {
boolean reverseValue = false;
if (propValue.startsWith("!")) {
reverseValue = true;
@ -86,7 +85,7 @@ public class PropertyProfileActivator implements ProfileActivator {
// we have a value, so it has to match the system value...
return reverseValue != propValue.equals(sysValue);
} else {
return reverseName != StringUtils.isNotEmpty(sysValue);
return reverseName != (sysValue != null && !sysValue.isEmpty());
}
}

View File

@ -606,7 +606,7 @@ public class DefaultModelValidator implements ModelValidator {
}
String sysPath = dependency.getSystemPath();
if (StringUtils.isNotEmpty(sysPath)) {
if (sysPath != null && !sysPath.isEmpty()) {
if (!hasExpression(sysPath)) {
addViolation(
problems,
@ -837,7 +837,7 @@ public class DefaultModelValidator implements ModelValidator {
if ("system".equals(d.getScope())) {
String systemPath = d.getSystemPath();
if (StringUtils.isEmpty(systemPath)) {
if (systemPath == null || systemPath.isEmpty()) {
addViolation(
problems,
Severity.ERROR,