You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2025/07/11 14:53:18 UTC
(maven-build-cache-extension) 01/01: Fixes #363 - Reduce the number of deprecated usages
This is an automated email from the ASF dual-hosted git repository.
khmarbaise pushed a commit to branch issues-363
in repository https://gitbox.apache.org/repos/asf/maven-build-cache-extension.git
commit 94935bb2d15dda5de3379cef13bc71ee874ab3a6
Author: Karl Heinz Marbaise <kh...@apache.org>
AuthorDate: Fri Jul 11 16:53:06 2025 +0200
Fixes #363 - Reduce the number of deprecated usages
---
.../BuildCacheMojosExecutionStrategy.java | 6 ++--
.../maven/buildcache/CacheControllerImpl.java | 13 ++++----
.../org/apache/maven/buildcache/CacheDiff.java | 16 +++++-----
.../org/apache/maven/buildcache/CacheUtils.java | 37 +++++++---------------
.../maven/buildcache/PluginScanConfigImpl.java | 8 ++---
.../maven/buildcache/checksum/DigestUtils.java | 24 +++++++-------
.../buildcache/checksum/MavenProjectInput.java | 23 ++++++--------
.../maven/buildcache/xml/CacheConfigImpl.java | 7 ++--
.../org/apache/maven/buildcache/xml/DtoUtils.java | 8 ++---
.../maven/buildcache/its/RemoteCacheDavTest.java | 8 ++---
10 files changed, 66 insertions(+), 84 deletions(-)
diff --git a/src/main/java/org/apache/maven/buildcache/BuildCacheMojosExecutionStrategy.java b/src/main/java/org/apache/maven/buildcache/BuildCacheMojosExecutionStrategy.java
index a63eccd..0a2d4d7 100644
--- a/src/main/java/org/apache/maven/buildcache/BuildCacheMojosExecutionStrategy.java
+++ b/src/main/java/org/apache/maven/buildcache/BuildCacheMojosExecutionStrategy.java
@@ -30,7 +30,7 @@
import java.util.Set;
import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.Strings;
import org.apache.maven.SessionScoped;
import org.apache.maven.buildcache.artifact.ArtifactRestorationReport;
import org.apache.maven.buildcache.checksum.MavenProjectInput;
@@ -388,8 +388,8 @@ boolean isParamsMatched(
return false;
}
- if (!StringUtils.equals(currentValue, expectedValue)) {
- if (!StringUtils.equals(currentValue, trackedProperty.getSkipValue())) {
+ if (!Strings.CS.equals(currentValue, expectedValue)) {
+ if (!Strings.CS.equals(currentValue, trackedProperty.getSkipValue())) {
LOGGER.info(
"Plugin parameter mismatch found. Parameter: {}, expected: {}, actual: {}",
propertyName,
diff --git a/src/main/java/org/apache/maven/buildcache/CacheControllerImpl.java b/src/main/java/org/apache/maven/buildcache/CacheControllerImpl.java
index 5a77473..cf69d4a 100644
--- a/src/main/java/org/apache/maven/buildcache/CacheControllerImpl.java
+++ b/src/main/java/org/apache/maven/buildcache/CacheControllerImpl.java
@@ -51,11 +51,12 @@
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;
import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.function.Function;
+import java.util.function.UnaryOperator;
import java.util.regex.Pattern;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.Strings;
import org.apache.commons.lang3.mutable.MutableBoolean;
import org.apache.maven.SessionScoped;
import org.apache.maven.artifact.handler.ArtifactHandler;
@@ -306,7 +307,7 @@ private boolean canIgnoreMissingSegment(MavenProject project, Build info, List<M
return true;
}
- private Function<File, File> createRestorationToDiskConsumer(final MavenProject project, final Artifact artifact) {
+ private UnaryOperator<File> createRestorationToDiskConsumer(final MavenProject project, final Artifact artifact) {
if (cacheConfig.isRestoreOnDiskArtifacts() && MavenProjectInput.isRestoreOnDiskArtifacts(project)) {
@@ -436,7 +437,7 @@ private RestoredArtifact restoredArtifact(
String artifactType,
String artifactClassifier,
Future<File> artifactFile,
- Function<File, File> restoreToDiskConsumer) {
+ UnaryOperator<File> restoreToDiskConsumer) {
ArtifactHandler handler = null;
if (artifactType != null) {
@@ -748,7 +749,7 @@ private boolean isExcluded(
List<PropertyName> forceLogProperties) {
if (!forceLogProperties.isEmpty()) {
for (PropertyName logProperty : forceLogProperties) {
- if (StringUtils.equals(propertyName, logProperty.getPropertyName())) {
+ if (Strings.CS.equals(propertyName, logProperty.getPropertyName())) {
return false;
}
}
@@ -757,7 +758,7 @@ private boolean isExcluded(
if (!excludedProperties.isEmpty()) {
for (PropertyName excludedProperty : excludedProperties) {
- if (StringUtils.equals(propertyName, excludedProperty.getPropertyName())) {
+ if (Strings.CS.equals(propertyName, excludedProperty.getPropertyName())) {
return true;
}
}
@@ -769,7 +770,7 @@ private boolean isExcluded(
private boolean isTracked(String propertyName, List<TrackedProperty> trackedProperties) {
for (TrackedProperty trackedProperty : trackedProperties) {
- if (StringUtils.equals(propertyName, trackedProperty.getPropertyName())) {
+ if (Strings.CS.equals(propertyName, trackedProperty.getPropertyName())) {
return true;
}
}
diff --git a/src/main/java/org/apache/maven/buildcache/CacheDiff.java b/src/main/java/org/apache/maven/buildcache/CacheDiff.java
index a378804..9c2977b 100644
--- a/src/main/java/org/apache/maven/buildcache/CacheDiff.java
+++ b/src/main/java/org/apache/maven/buildcache/CacheDiff.java
@@ -28,7 +28,7 @@
import java.util.Set;
import java.util.stream.Collectors;
-import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.Strings;
import org.apache.maven.buildcache.xml.CacheConfig;
import org.apache.maven.buildcache.xml.build.Build;
import org.apache.maven.buildcache.xml.build.CompletedExecution;
@@ -56,7 +56,7 @@ public CacheDiff(Build current, Build baseline, CacheConfig config) {
}
public Diff compare() {
- if (!StringUtils.equals(current.getHashFunction(), baseline.getHashFunction())) {
+ if (!Strings.CS.equals(current.getHashFunction(), baseline.getHashFunction())) {
addNewMismatch(
"hashFunction",
current.getHashFunction(),
@@ -82,7 +82,7 @@ private void compareEffectivePoms(ProjectsInputInfo current, ProjectsInputInfo b
Optional<DigestItem> baseLinePom = findPom(baseline);
String baselinePomHash = baseLinePom.map(DigestItem::getHash).orElse(null);
- if (!StringUtils.equals(currentPomHash, baselinePomHash)) {
+ if (!Strings.CS.equals(currentPomHash, baselinePomHash)) {
addNewMismatch(
"effectivePom",
currentPomHash,
@@ -131,17 +131,17 @@ private void compareFiles(ProjectsInputInfo current, ProjectsInputInfo baseline)
DigestItem currentFile = entry.getValue();
// should be null safe because sets are compared above for differences
final DigestItem baselineFile = baselineFiles.get(filePath);
- if (!StringUtils.equals(currentFile.getHash(), baselineFile.getHash())) {
+ if (!Strings.CS.equals(currentFile.getHash(), baselineFile.getHash())) {
String reason = "File content is different.";
if (currentFile.getEol() != null
&& baselineFile.getEol() != null
- && !StringUtils.equals(baselineFile.getEol(), currentFile.getEol())) {
+ && !Strings.CS.equals(baselineFile.getEol(), currentFile.getEol())) {
reason += " Different line endings detected (text files relevant). " + "Remote: "
+ baselineFile.getEol() + ", local: " + currentFile.getEol() + ".";
}
if (currentFile.getCharset() != null
&& baselineFile.getCharset() != null
- && !StringUtils.equals(baselineFile.getCharset(), currentFile.getCharset())) {
+ && !Strings.CS.equals(baselineFile.getCharset(), currentFile.getCharset())) {
reason += " Different charset detected (text files relevant). " + "Remote: " + baselineFile.getEol()
+ ", local: " + currentFile.getEol() + ".";
}
@@ -205,7 +205,7 @@ private void compareDependencies(String property, List<DigestItem> current, List
DigestItem currentDependency = entry.getValue();
// null safe - sets compared for differences above
final DigestItem baselineDependency = baselineDependencies.get(dependencyKey);
- if (!StringUtils.equals(currentDependency.getHash(), baselineDependency.getHash())) {
+ if (!Strings.CS.equals(currentDependency.getHash(), baselineDependency.getHash())) {
addNewMismatch(
dependencyKey,
currentDependency.getHash(),
@@ -276,7 +276,7 @@ private void comparePlugins(CompletedExecution current, CompletedExecution basel
for (PropertyValue p : trackedProperties) {
final PropertyValue baselineValue = baselinePropertiesByName.get(p.getName());
- if (baselineValue == null || !StringUtils.equals(baselineValue.getValue(), p.getValue())) {
+ if (baselineValue == null || !Strings.CS.equals(baselineValue.getValue(), p.getValue())) {
addNewMismatch(
p.getName(),
p.getValue(),
diff --git a/src/main/java/org/apache/maven/buildcache/CacheUtils.java b/src/main/java/org/apache/maven/buildcache/CacheUtils.java
index 61b9bc5..2eded63 100644
--- a/src/main/java/org/apache/maven/buildcache/CacheUtils.java
+++ b/src/main/java/org/apache/maven/buildcache/CacheUtils.java
@@ -20,7 +20,6 @@
import java.io.File;
import java.io.IOException;
-import java.nio.charset.StandardCharsets;
import java.nio.file.FileSystems;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
@@ -34,12 +33,13 @@
import java.util.Collection;
import java.util.List;
import java.util.NoSuchElementException;
-import java.util.function.Supplier;
+import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.Strings;
import org.apache.commons.lang3.mutable.MutableBoolean;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.handler.ArtifactHandler;
@@ -48,11 +48,8 @@
import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.project.MavenProject;
-import org.eclipse.aether.SessionData;
import org.slf4j.Logger;
-import static org.apache.commons.lang3.StringUtils.removeStart;
-import static org.apache.commons.lang3.StringUtils.trim;
import static org.apache.maven.artifact.Artifact.LATEST_VERSION;
import static org.apache.maven.artifact.Artifact.SNAPSHOT_VERSION;
@@ -92,14 +89,14 @@ public static String normalizedName(Artifact artifact) {
}
public static String mojoExecutionKey(MojoExecution mojo) {
- return StringUtils.join(
+ return String.join(
+ ":",
Arrays.asList(
StringUtils.defaultIfEmpty(mojo.getExecutionId(), "emptyExecId"),
StringUtils.defaultIfEmpty(mojo.getGoal(), "emptyGoal"),
StringUtils.defaultIfEmpty(mojo.getLifecyclePhase(), "emptyLifecyclePhase"),
StringUtils.defaultIfEmpty(mojo.getArtifactId(), "emptyArtifactId"),
- StringUtils.defaultIfEmpty(mojo.getGroupId(), "emptyGroupId")),
- ":");
+ StringUtils.defaultIfEmpty(mojo.getGroupId(), "emptyGroupId")));
}
public static Path getMultimoduleRoot(MavenSession session) {
@@ -114,12 +111,12 @@ public static Scm readGitInfo(MavenSession session) throws IOException {
if (Files.exists(headFile)) {
String headRef = readFirstLine(headFile, "<missing branch>");
if (headRef.startsWith("ref: ")) {
- String branch = trim(removeStart(headRef, "ref: "));
+ String branch = Strings.CS.removeStart(headRef, "ref: ").trim();
scmCandidate.setSourceBranch(branch);
final Path refPath = gitDir.resolve(branch);
if (Files.exists(refPath)) {
String revision = readFirstLine(refPath, "<missing revision>");
- scmCandidate.setRevision(trim(revision));
+ scmCandidate.setRevision(revision.trim());
}
} else {
scmCandidate.setSourceBranch(headRef);
@@ -131,7 +128,9 @@ public static Scm readGitInfo(MavenSession session) throws IOException {
}
private static String readFirstLine(Path path, String defaultValue) throws IOException {
- return Files.lines(path, StandardCharsets.UTF_8).findFirst().orElse(defaultValue);
+ try (Stream<String> lines = Files.lines(path)) {
+ return lines.findFirst().orElse(defaultValue);
+ }
}
public static <T> T getLast(List<T> list) {
@@ -142,26 +141,12 @@ public static <T> T getLast(List<T> list) {
throw new NoSuchElementException();
}
- public static <T> T getOrCreate(MavenSession session, Object key, Supplier<T> supplier) {
- SessionData data = session.getRepositorySession().getData();
- while (true) {
- T t = (T) data.get(key);
- if (t == null) {
- t = supplier.get();
- if (data.set(key, null, t)) {
- continue;
- }
- }
- return t;
- }
- }
-
public static boolean isArchive(File file) {
String fileName = file.getName();
if (!file.isFile() || file.isHidden()) {
return false;
}
- return StringUtils.endsWithAny(fileName, ".jar", ".zip", ".war", ".ear");
+ return Strings.CS.endsWithAny(fileName, ".jar", ".zip", ".war", ".ear");
}
/**
diff --git a/src/main/java/org/apache/maven/buildcache/PluginScanConfigImpl.java b/src/main/java/org/apache/maven/buildcache/PluginScanConfigImpl.java
index 9f59dc5..04206ff 100644
--- a/src/main/java/org/apache/maven/buildcache/PluginScanConfigImpl.java
+++ b/src/main/java/org/apache/maven/buildcache/PluginScanConfigImpl.java
@@ -22,7 +22,7 @@
import java.util.List;
-import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.Strings;
import org.apache.maven.buildcache.xml.config.DirScanConfig;
import org.apache.maven.buildcache.xml.config.TagExclude;
import org.apache.maven.buildcache.xml.config.TagScanConfig;
@@ -40,7 +40,7 @@ public PluginScanConfigImpl(DirScanConfig scanConfig) {
@Override
public boolean isSkip() {
- return StringUtils.equals(dto.getMode(), "skip");
+ return Strings.CS.equals(dto.getMode(), "skip");
}
@Override
@@ -58,7 +58,7 @@ public boolean accept(String tagName) {
private boolean contains(List<TagExclude> excludes, String tagName) {
for (TagExclude exclude : excludes) {
- if (StringUtils.equals(exclude.getTagName(), tagName)) {
+ if (Strings.CS.equals(exclude.getTagName(), tagName)) {
return true;
}
}
@@ -122,7 +122,7 @@ private ScanConfigProperties findConfigByName(String tagName, List<TagScanConfig
}
for (TagScanConfig config : configs) {
- if (StringUtils.equals(tagName, config.getTagName())) {
+ if (Strings.CS.equals(tagName, config.getTagName())) {
return new ScanConfigProperties(config.isRecursive(), config.getGlob());
}
}
diff --git a/src/main/java/org/apache/maven/buildcache/checksum/DigestUtils.java b/src/main/java/org/apache/maven/buildcache/checksum/DigestUtils.java
index ee78733..a365d52 100644
--- a/src/main/java/org/apache/maven/buildcache/checksum/DigestUtils.java
+++ b/src/main/java/org/apache/maven/buildcache/checksum/DigestUtils.java
@@ -24,9 +24,11 @@
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.util.Objects;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.Strings;
import org.apache.maven.buildcache.hash.HashChecksum;
import org.apache.maven.buildcache.xml.build.DigestItem;
import org.mozilla.universalchardet.UniversalDetector;
@@ -34,10 +36,6 @@
import org.slf4j.LoggerFactory;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static org.apache.commons.lang3.StringUtils.containsAny;
-import static org.apache.commons.lang3.StringUtils.equalsAny;
-import static org.apache.commons.lang3.StringUtils.startsWith;
-import static org.apache.commons.lang3.StringUtils.startsWithAny;
/**
* DigestUtils
@@ -60,8 +58,8 @@ public static DigestItem file(HashChecksum checksum, Path basedir, Path file) th
DigestItem item = item("file", normalized, checksum.update(content));
try {
populateContentDetails(file, content, item);
- } catch (IOException ignore) {
- LOGGER.debug("Failed to compute digest for file {}", normalized, ignore);
+ } catch (IOException exception) {
+ LOGGER.debug("Failed to compute digest for file {}", normalized, exception);
}
return item;
}
@@ -86,16 +84,16 @@ private static void populateContentDetails(Path file, byte[] content, DigestItem
}
CharBuffer charBuffer = charset.decode(ByteBuffer.wrap(content));
String lineSeparator = detectLineSeparator(charBuffer);
- item.setEol(StringUtils.defaultString(lineSeparator, "unknown"));
+ item.setEol(Objects.toString(lineSeparator, "unknown"));
}
}
// TODO add support for .gitattributes to statically configure file type before falling back to probe based content
// checks
private static boolean isText(String contentType) {
- return startsWith(contentType, "text/")
- || containsAny(contentType, "+json", "+xml") // common mime type suffixes
- || equalsAny(
+ return Strings.CS.startsWith(contentType, "text/")
+ || Strings.CS.containsAny(contentType, "+json", "+xml") // common mime type suffixes
+ || Strings.CS.equalsAny(
contentType, // some common text types
"application/json",
"application/rtf",
@@ -106,9 +104,9 @@ private static boolean isText(String contentType) {
}
private static boolean isBinary(String contentType) {
- return startsWithAny(contentType, "image/", "audio/", "video/", "font/")
- || containsAny(contentType, "+zip", "+gzip")
- || equalsAny(
+ return Strings.CS.startsWithAny(contentType, "image/", "audio/", "video/", "font/")
+ || Strings.CS.containsAny(contentType, "+zip", "+gzip")
+ || Strings.CS.equalsAny(
contentType,
"application/octet-stream",
"application/java-archive",
diff --git a/src/main/java/org/apache/maven/buildcache/checksum/MavenProjectInput.java b/src/main/java/org/apache/maven/buildcache/checksum/MavenProjectInput.java
index a3cb065..e549c12 100644
--- a/src/main/java/org/apache/maven/buildcache/checksum/MavenProjectInput.java
+++ b/src/main/java/org/apache/maven/buildcache/checksum/MavenProjectInput.java
@@ -49,7 +49,7 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Predicate;
-import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.Strings;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact;
import org.apache.maven.artifact.handler.ArtifactHandler;
@@ -91,12 +91,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static org.apache.commons.lang3.StringUtils.contains;
import static org.apache.commons.lang3.StringUtils.defaultIfEmpty;
-import static org.apache.commons.lang3.StringUtils.equalsAnyIgnoreCase;
import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.StringUtils.replaceEachRepeatedly;
-import static org.apache.commons.lang3.StringUtils.startsWithAny;
import static org.apache.commons.lang3.StringUtils.stripToEmpty;
import static org.apache.maven.buildcache.CacheUtils.isPom;
import static org.apache.maven.buildcache.CacheUtils.isSnapshot;
@@ -298,7 +295,7 @@ private void checkEffectivePomMatch(ProjectsInputInfo baselineBuild, DigestItem
if (pomHolder.isPresent()) {
DigestItem pomItem = pomHolder.get();
- final boolean matches = StringUtils.equals(pomItem.getHash(), effectivePomChecksum.getHash());
+ final boolean matches = Strings.CS.equals(pomItem.getHash(), effectivePomChecksum.getHash());
if (!matches) {
LOGGER.info(
"Mismatch in effective poms. Current: {}, remote: {}",
@@ -322,7 +319,7 @@ private boolean checkItemMatchesBaseline(ProjectsInputInfo baselineBuild, Digest
boolean matched = false;
if (baselineFileDigest.isPresent()) {
String hash = baselineFileDigest.get().getHash();
- matched = StringUtils.equals(hash, fileDigest.getHash());
+ matched = Strings.CS.equals(hash, fileDigest.getHash());
if (!matched) {
LOGGER.info(
"Mismatch in {}: {}. Local hash: {}, remote: {}",
@@ -578,12 +575,12 @@ private Path getPathOrNull(String text) {
// small optimization to not probe not-paths
if (isBlank(text)) {
// do not even bother logging about blank/null values
- } else if (equalsAnyIgnoreCase(text, "true", "false", "utf-8", "null", "\\") // common values
- || contains(text, "*") // tag value is a glob or regex - unclear how to process
- || (contains(text, ":") && !contains(text, ":\\")) // artifactId
- || startsWithAny(text, "com.", "org.", "io.", "java.", "javax.") // java packages
- || startsWithAny(text, "${env.") // env variables in maven notation
- || startsWithAny(
+ } else if (Strings.CI.equalsAny(text, "true", "false", "utf-8", "null", "\\") // common values
+ || Strings.CS.contains(text, "*") // tag value is a glob or regex - unclear how to process
+ || (Strings.CS.contains(text, ":") && !Strings.CS.contains(text, ":\\")) // artifactId
+ || Strings.CS.startsWithAny(text, "com.", "org.", "io.", "java.", "javax.") // java packages
+ || Strings.CS.startsWithAny(text, "${env.") // env variables in maven notation
+ || Strings.CS.startsWithAny(
text,
"http:",
"https:",
@@ -595,7 +592,7 @@ private Path getPathOrNull(String text) {
"classpath:")) // urls identified by common protocols
{
LOGGER.debug("Skipping directory (blacklisted literal): {}", text);
- } else if (startsWithAny(text, tmpDir)) // tmp dir
+ } else if (Strings.CS.startsWithAny(text, tmpDir)) // tmp dir
{
LOGGER.debug("Skipping directory (temp dir): {}", text);
} else {
diff --git a/src/main/java/org/apache/maven/buildcache/xml/CacheConfigImpl.java b/src/main/java/org/apache/maven/buildcache/xml/CacheConfigImpl.java
index 566a067..87b1ad5 100644
--- a/src/main/java/org/apache/maven/buildcache/xml/CacheConfigImpl.java
+++ b/src/main/java/org/apache/maven/buildcache/xml/CacheConfigImpl.java
@@ -33,6 +33,7 @@
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.Strings;
import org.apache.maven.SessionScoped;
import org.apache.maven.buildcache.DefaultPluginScanConfig;
import org.apache.maven.buildcache.PluginScanConfig;
@@ -261,7 +262,7 @@ private GoalReconciliation findReconciliationConfig(MojoExecution mojoExecution)
final String goal = mojoExecution.getGoal();
if (isPluginMatch(mojoExecution.getPlugin(), goalReconciliationConfig)
- && StringUtils.equals(goal, goalReconciliationConfig.getGoal())) {
+ && Strings.CS.equals(goal, goalReconciliationConfig.getGoal())) {
return goalReconciliationConfig;
}
}
@@ -339,9 +340,9 @@ private PluginConfigurationScan findPluginScanConfig(Plugin plugin) {
}
private boolean isPluginMatch(Plugin plugin, CoordinatesBase pluginConfig) {
- return StringUtils.equals(pluginConfig.getArtifactId(), plugin.getArtifactId())
+ return Strings.CS.equals(pluginConfig.getArtifactId(), plugin.getArtifactId())
&& (pluginConfig.getGroupId() == null
- || StringUtils.equals(pluginConfig.getGroupId(), plugin.getGroupId()));
+ || Strings.CS.equals(pluginConfig.getGroupId(), plugin.getGroupId()));
}
@Nonnull
diff --git a/src/main/java/org/apache/maven/buildcache/xml/DtoUtils.java b/src/main/java/org/apache/maven/buildcache/xml/DtoUtils.java
index 7f17f80..3c8b3a7 100644
--- a/src/main/java/org/apache/maven/buildcache/xml/DtoUtils.java
+++ b/src/main/java/org/apache/maven/buildcache/xml/DtoUtils.java
@@ -23,7 +23,7 @@
import java.util.List;
import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.Strings;
import org.apache.maven.buildcache.CacheUtils;
import org.apache.maven.buildcache.xml.build.Artifact;
import org.apache.maven.buildcache.xml.build.CompletedExecution;
@@ -49,7 +49,7 @@ public static String findPropertyValue(String propertyName, CompletedExecution c
return null;
}
for (PropertyValue property : properties) {
- if (StringUtils.equals(propertyName, property.getName())) {
+ if (Strings.CS.equals(propertyName, property.getName())) {
return property.getValue();
}
}
@@ -116,7 +116,7 @@ public static void addProperty(
value = ArrayUtils.toString(value);
}
final String valueText = String.valueOf(value);
- valueType.setValue(StringUtils.remove(valueText, baseDirPath));
+ valueType.setValue(Strings.CS.remove(valueText, baseDirPath));
valueType.setTracked(tracked);
execution.addProperty(valueType);
}
@@ -153,7 +153,7 @@ public static boolean containsAllProperties(
public static boolean contains(List<PropertyValue> executionProperties, String propertyName) {
for (PropertyValue executionProperty : executionProperties) {
- if (StringUtils.equals(executionProperty.getName(), propertyName)) {
+ if (Strings.CS.equals(executionProperty.getName(), propertyName)) {
return true;
}
}
diff --git a/src/test/java/org/apache/maven/buildcache/its/RemoteCacheDavTest.java b/src/test/java/org/apache/maven/buildcache/its/RemoteCacheDavTest.java
index 534af22..baf0984 100644
--- a/src/test/java/org/apache/maven/buildcache/its/RemoteCacheDavTest.java
+++ b/src/test/java/org/apache/maven/buildcache/its/RemoteCacheDavTest.java
@@ -53,9 +53,9 @@
@IntegrationTest("src/test/projects/remote-cache-dav")
@Testcontainers(disabledWithoutDocker = true)
-public class RemoteCacheDavTest {
+class RemoteCacheDavTest {
- public static final String DAV_DOCKER_IMAGE =
+ private static final String DAV_DOCKER_IMAGE =
"xama/nginx-webdav@sha256:84171a7e67d7e98eeaa67de58e3ce141ec1d0ee9c37004e7096698c8379fd9cf";
private static final String DAV_USERNAME = "admin";
private static final String DAV_PASSWORD = "admin";
@@ -107,7 +107,7 @@ void setup() throws IOException {
}
@AfterEach
- public void cleanup() throws Exception {
+ void cleanup() throws Exception {
dav.execInContainer("rm", "-rf", "/var/webdav");
cleanDirs(localCache);
dav.close();
@@ -119,7 +119,7 @@ public static Stream<Arguments> transports() {
@ParameterizedTest
@MethodSource("transports")
- public void doTestRemoteCache(String transport) throws VerificationException, IOException {
+ void doTestRemoteCache(String transport) throws VerificationException, IOException {
String url =
("wagon".equals(transport) ? "dav:" : "") + "http://localhost:" + dav.getFirstMappedPort() + "/mbce";
substitute(