This is an automated email from the ASF dual-hosted git repository. elharo pushed a commit to branch more2 in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git
commit c872222da051c459a96dc5918de863e3d1d13142 Author: Elliotte Rusty Harold <elh...@ibiblio.org> AuthorDate: Sun Nov 24 10:28:57 2024 -0500 Decouple DependencyUtil from StringUtils --- .../plugins/dependency/utils/DependencyUtil.java | 15 ++------------- .../plugins/dependency/utils/TestDependencyUtil.java | 20 -------------------- 2 files changed, 2 insertions(+), 33 deletions(-) diff --git a/src/main/java/org/apache/maven/plugins/dependency/utils/DependencyUtil.java b/src/main/java/org/apache/maven/plugins/dependency/utils/DependencyUtil.java index 6dad61eb..54eb0adb 100644 --- a/src/main/java/org/apache/maven/plugins/dependency/utils/DependencyUtil.java +++ b/src/main/java/org/apache/maven/plugins/dependency/utils/DependencyUtil.java @@ -29,7 +29,6 @@ import java.nio.file.OpenOption; import java.nio.file.StandardOpenOption; import java.util.Objects; -import org.apache.commons.lang3.StringUtils; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.ArtifactUtils; import org.apache.maven.plugin.logging.Log; @@ -119,7 +118,7 @@ public final class DependencyUtil { String classifierString = ""; - if (!removeClassifier && StringUtils.isNotEmpty(artifact.getClassifier())) { + if (!removeClassifier && artifact.getClassifier() != null && !artifact.getClassifier().isEmpty()) { classifierString = "-" + artifact.getClassifier(); } destFileName.append(artifact.getArtifactId()).append(versionString); @@ -186,7 +185,7 @@ public final class DependencyUtil { sb.append(artifact.getVersion()); } - if (StringUtils.isNotEmpty(artifact.getClassifier())) { + if (artifact.getClassifier() != null && !artifact.getClassifier().isEmpty()) { sb.append("-"); sb.append(artifact.getClassifier()); } @@ -259,16 +258,6 @@ public final class DependencyUtil { } } - /** - * Mainly used to parse excludes, includes configuration. - * - * @param str the string to split - * @return the result items - */ - public static String[] tokenizer(String str) { - return StringUtils.split(cleanToBeTokenizedString(str), ","); - } - /** * Clean up configuration string before it can be tokenized. * diff --git a/src/test/java/org/apache/maven/plugins/dependency/utils/TestDependencyUtil.java b/src/test/java/org/apache/maven/plugins/dependency/utils/TestDependencyUtil.java index ceaa05a7..8de8ce0d 100644 --- a/src/test/java/org/apache/maven/plugins/dependency/utils/TestDependencyUtil.java +++ b/src/test/java/org/apache/maven/plugins/dependency/utils/TestDependencyUtil.java @@ -320,26 +320,6 @@ class TestDependencyUtil { assertEquals(expectedResult, name); } - @Test - void testTokenizer() { - String[] tokens = DependencyUtil.tokenizer(" alpha,bravo, charlie , delta kappa, theta"); - String[] expected = new String[] {"alpha", "bravo", "charlie", "delta kappa", "theta"}; - // easier to see in the JUnit reports - assertEquals(String.join(", ", expected), String.join(", ", tokens)); - assertEquals(expected.length, tokens.length); - - tokens = DependencyUtil.tokenizer(" \r\n a, \t \n \r b \t \n \r"); - assertEquals(2, tokens.length); - assertEquals("a", tokens[0]); - assertEquals("b", tokens[1]); - - tokens = DependencyUtil.tokenizer(null); - assertEquals(0, tokens.length); - - tokens = DependencyUtil.tokenizer(" "); - assertEquals(0, tokens.length); - } - @Test void outputFileShouldBeOverridden() throws IOException { File file = new File(temDir, "file1.out");