Skip to content

Commit 4c3568e

Browse files
1 parent abc76b5 commit 4c3568e

File tree

8 files changed

+22
-28
lines changed

8 files changed

+22
-28
lines changed

src/main/java/org/apache/maven/plugins/dependency/PurgeLocalRepositoryMojo.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import java.util.List;
2828
import java.util.Set;
2929

30-
import org.apache.commons.lang3.StringUtils;
3130
import org.apache.maven.artifact.Artifact;
3231
import org.apache.maven.artifact.ArtifactUtils;
3332
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
@@ -298,7 +297,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
298297
return;
299298
}
300299

301-
if (!StringUtils.isEmpty(manualInclude)) {
300+
if (!(manualInclude == null || manualInclude.isEmpty())) {
302301
manualIncludes = this.parseIncludes(manualInclude);
303302
}
304303
// If it's a manual purge, the only step is to delete from the local repo
@@ -382,13 +381,13 @@ private void manualPurge(List<String> theIncludes) throws MojoExecutionException
382381
.toString());
383382

384383
for (String gavPattern : theIncludes) {
385-
if (StringUtils.isEmpty(gavPattern)) {
384+
if (gavPattern == null || gavPattern.isEmpty()) {
386385
getLog().debug("Skipping empty gav pattern");
387386
continue;
388387
}
389388

390389
String relativePath = gavToPath(gavPattern);
391-
if (StringUtils.isEmpty(relativePath)) {
390+
if (relativePath == null || relativePath.isEmpty()) {
392391
getLog().debug("Skipping empty relative path for gav pattern: " + gavPattern);
393392
continue;
394393
}
@@ -414,7 +413,7 @@ private void manualPurge(List<String> theIncludes) throws MojoExecutionException
414413
* @return the corresponding path
415414
*/
416415
private String gavToPath(String gav) {
417-
if (StringUtils.isEmpty(gav)) {
416+
if (gav == null || gav.isEmpty()) {
418417
return null;
419418
}
420419

@@ -450,14 +449,14 @@ private TransformableFilter createPurgeArtifactsFilter(
450449
}
451450

452451
// The CLI includes/excludes overrides configuration in the pom
453-
if (!StringUtils.isEmpty(this.include)) {
452+
if (!(this.include == null || this.include.isEmpty())) {
454453
this.includes = parseIncludes(this.include);
455454
}
456455
if (this.includes != null) {
457456
subFilters.add(new PatternInclusionsFilter(includes));
458457
}
459458

460-
if (!StringUtils.isEmpty(this.exclude)) {
459+
if (!(this.exclude == null || this.exclude.isEmpty())) {
461460
this.excludes = parseIncludes(this.exclude);
462461
}
463462
if (this.excludes != null) {

src/main/java/org/apache/maven/plugins/dependency/fromDependencies/AbstractDependencyFilterMojo.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import java.util.LinkedHashSet;
2525
import java.util.Set;
2626

27-
import org.apache.commons.lang3.StringUtils;
2827
import org.apache.maven.artifact.Artifact;
2928
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
3029
import org.apache.maven.plugin.MojoExecutionException;
@@ -337,7 +336,7 @@ protected DependencyStatusSets getDependencySets(boolean stopOnFailure, boolean
337336

338337
// transform artifacts if classifier is set
339338
DependencyStatusSets status;
340-
if (StringUtils.isNotEmpty(classifier)) {
339+
if (classifier != null && !classifier.isEmpty()) {
341340
status = getClassifierTranslatedDependencies(artifacts, stopOnFailure);
342341
} else {
343342
status = filterMarkedDependencies(artifacts);
@@ -395,7 +394,7 @@ protected DependencyStatusSets getClassifierTranslatedDependencies(Set<Artifact>
395394
// possibly translate artifacts into a new set of artifacts based on the
396395
// classifier and type
397396
// if this did something, we need to resolve the new artifacts
398-
if (StringUtils.isNotEmpty(classifier)) {
397+
if (classifier != null && !classifier.isEmpty()) {
399398
ArtifactTranslator translator =
400399
new ClassifierTypeTranslator(artifactHandlerManager, this.classifier, this.type);
401400
Collection<ArtifactCoordinate> coordinates = translator.translate(artifacts, getLog());

src/main/java/org/apache/maven/plugins/dependency/fromDependencies/BuildClasspathMojo.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,11 @@ public class BuildClasspathMojo extends AbstractDependencyFilterMojo implements
178178
@Override
179179
protected void doExecute() throws MojoExecutionException {
180180
// initialize the separators.
181-
boolean isFileSepSet = StringUtils.isNotEmpty(fileSeparator);
182-
boolean isPathSepSet = StringUtils.isNotEmpty(pathSeparator);
181+
boolean isFileSepSet = fileSeparator != null && !fileSeparator.isEmpty();
182+
boolean isPathSepSet = pathSeparator != null && !pathSeparator.isEmpty();
183183

184184
// don't allow them to have absolute paths when they attach.
185-
if (attach && StringUtils.isEmpty(localRepoProperty)) {
185+
if (attach && (localRepoProperty == null || localRepoProperty.isEmpty())) {
186186
localRepoProperty = "${M2_REPO}";
187187
}
188188

@@ -264,7 +264,7 @@ protected void appendArtifactPath(Artifact art, StringBuilder sb) {
264264
if (prefix == null) {
265265
String file = art.getFile().getPath();
266266
// substitute the property for the local repo path to make the classpath file portable.
267-
if (StringUtils.isNotEmpty(localRepoProperty)) {
267+
if (localRepoProperty != null && !localRepoProperty.isEmpty()) {
268268
ProjectBuildingRequest projectBuildingRequest = session.getProjectBuildingRequest();
269269
File localBasedir = repositoryManager.getLocalRepositoryBasedir(projectBuildingRequest);
270270

src/main/java/org/apache/maven/plugins/dependency/utils/DependencyUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ public static String[] tokenizer(String str) {
271271
*/
272272
public static String cleanToBeTokenizedString(String str) {
273273
String ret = "";
274-
if (!StringUtils.isEmpty(str)) {
274+
if (!(str == null || str.isEmpty())) {
275275
// remove initial and ending spaces, plus all spaces next to commas
276276
ret = str.trim().replaceAll("[\\s]*,[\\s]*", ",");
277277
}

src/main/java/org/apache/maven/plugins/dependency/utils/UnpackUtil.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
import java.io.File;
2626

27-
import org.apache.commons.lang3.StringUtils;
2827
import org.apache.maven.plugin.MojoExecutionException;
2928
import org.apache.maven.plugin.logging.Log;
3029
import org.codehaus.plexus.archiver.ArchiverException;
@@ -127,18 +126,18 @@ public void unpack(
127126

128127
unArchiver.setDestDirectory(location);
129128

130-
if (StringUtils.isNotEmpty(excludes) || StringUtils.isNotEmpty(includes)) {
129+
if ((excludes != null && !excludes.isEmpty()) || (includes != null && !includes.isEmpty())) {
131130
// Create the selectors that will filter
132131
// based on include/exclude parameters
133132
// MDEP-47
134133
IncludeExcludeFileSelector[] selectors =
135134
new IncludeExcludeFileSelector[] {new IncludeExcludeFileSelector()};
136135

137-
if (StringUtils.isNotEmpty(excludes)) {
136+
if (excludes != null && !excludes.isEmpty()) {
138137
selectors[0].setExcludes(excludes.split(","));
139138
}
140139

141-
if (StringUtils.isNotEmpty(includes)) {
140+
if (includes != null && !includes.isEmpty()) {
142141
selectors[0].setIncludes(includes.split(","));
143142
}
144143

src/main/java/org/apache/maven/plugins/dependency/utils/translators/ClassifierTypeTranslator.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.util.LinkedHashSet;
2222
import java.util.Set;
2323

24-
import org.apache.commons.lang3.StringUtils;
2524
import org.apache.maven.artifact.Artifact;
2625
import org.apache.maven.artifact.handler.ArtifactHandler;
2726
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
@@ -67,7 +66,7 @@ public Set<ArtifactCoordinate> translate(Set<Artifact> artifacts, Log log) {
6766
// will use the
6867
// base artifact value if null comes in
6968
final String useType;
70-
if (StringUtils.isNotEmpty(this.type)) {
69+
if (this.type != null && !this.type.isEmpty()) {
7170
useType = this.type;
7271
} else {
7372
useType = artifact.getType();
@@ -83,7 +82,7 @@ public Set<ArtifactCoordinate> translate(Set<Artifact> artifacts, Log log) {
8382
}
8483

8584
String useClassifier;
86-
if (StringUtils.isNotEmpty(this.classifier)) {
85+
if (this.classifier != null && !this.classifier.isEmpty()) {
8786
useClassifier = this.classifier;
8887
} else {
8988
useClassifier = artifact.getClassifier();

src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestCopyDependenciesMojo.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import java.util.HashSet;
2424
import java.util.Set;
2525

26-
import org.apache.commons.lang3.StringUtils;
2726
import org.apache.maven.artifact.Artifact;
2827
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
2928
import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
@@ -390,10 +389,10 @@ public void dotestClassifierType(String testClassifier, String testType) throws
390389
String useClassifier = artifact.getClassifier();
391390
String useType = artifact.getType();
392391

393-
if (StringUtils.isNotEmpty(testClassifier)) {
392+
if (testClassifier != null && !testClassifier.isEmpty()) {
394393
useClassifier = "-" + testClassifier;
395394
// type is only used if classifier is used.
396-
if (StringUtils.isNotEmpty(testType)) {
395+
if (testType != null && !testType.isEmpty()) {
397396
useType = testType;
398397
}
399398
}

src/test/java/org/apache/maven/plugins/dependency/fromDependencies/TestUnpackDependenciesMojo.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import java.util.Iterator;
2525
import java.util.Set;
2626

27-
import org.apache.commons.lang3.StringUtils;
2827
import org.apache.maven.artifact.Artifact;
2928
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
3029
import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
@@ -465,10 +464,10 @@ public void dotestClassifierType(String testClassifier, String testType) throws
465464
String useClassifier = artifact.getClassifier();
466465
String useType = artifact.getType();
467466

468-
if (StringUtils.isNotEmpty(testClassifier)) {
467+
if (testClassifier != null && !testClassifier.isEmpty()) {
469468
useClassifier = testClassifier;
470469
// type is only used if classifier is used.
471-
if (StringUtils.isNotEmpty(testType)) {
470+
if (testType != null && !testType.isEmpty()) {
472471
useType = testType;
473472
}
474473
}

0 commit comments

Comments
 (0)