diff --git a/plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/IssuesScanner.java b/plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/IssuesScanner.java index e49b1f37d7..e360817595 100644 --- a/plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/IssuesScanner.java +++ b/plugin/src/main/java/io/jenkins/plugins/analysis/core/steps/IssuesScanner.java @@ -9,6 +9,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -20,8 +21,8 @@ import edu.hm.hafner.analysis.FileNameResolver; import edu.hm.hafner.analysis.FingerprintGenerator; import edu.hm.hafner.analysis.FullTextFingerprint; -import edu.hm.hafner.analysis.ModuleDetector; -import edu.hm.hafner.analysis.ModuleDetector.FileSystem; +import edu.hm.hafner.analysis.ModuleDetectorRunner; +import edu.hm.hafner.analysis.ModuleDetectorRunner.FileSystemFacade; import edu.hm.hafner.analysis.ModuleResolver; import edu.hm.hafner.analysis.PackageNameResolver; import edu.hm.hafner.analysis.Report; @@ -335,8 +336,9 @@ private void resolveModuleNames(final Report report, final File workspace) { report.logInfo("Resolving module names from module definitions (build.xml, pom.xml, or Manifest.mf files)"); try { - ModuleResolver resolver = new ModuleResolver(); - resolver.run(report, new ModuleDetector(workspace.toPath(), new DefaultFileSystem())); + var runner = new ModuleDetectorRunner(workspace.toPath(), new DefaultFileSystem()); + var resolver = new ModuleResolver(runner); + resolver.run(report); } catch (InvalidPathException exception) { report.logException(exception, "Resolving of modul names aborted"); @@ -370,7 +372,7 @@ private void createFingerprints(final Report report) { /** * Provides file system operations using real IO. */ - private static final class DefaultFileSystem implements FileSystem { + private static final class DefaultFileSystem implements FileSystemFacade { @MustBeClosed @Override public InputStream open(final String fileName) throws IOException { @@ -378,8 +380,8 @@ public InputStream open(final String fileName) throws IOException { } @Override - public String[] find(final Path root, final String pattern) { - return new FileFinder(pattern).find(root.toFile()); + public List find(final Path root, final String pattern) { + return Arrays.stream(new FileFinder(pattern).find(root.toFile())).toList(); } } } diff --git a/plugin/src/test/java/io/jenkins/plugins/analysis/warnings/steps/ModuleDetectorITest.java b/plugin/src/test/java/io/jenkins/plugins/analysis/warnings/steps/ModuleDetectorITest.java index 20c4a7a089..24bb11c9fb 100644 --- a/plugin/src/test/java/io/jenkins/plugins/analysis/warnings/steps/ModuleDetectorITest.java +++ b/plugin/src/test/java/io/jenkins/plugins/analysis/warnings/steps/ModuleDetectorITest.java @@ -10,7 +10,7 @@ import org.junit.jupiter.api.Test; -import edu.hm.hafner.analysis.ModuleDetector; +import edu.hm.hafner.analysis.ModuleDetectorRunner; import hudson.FilePath; import hudson.model.FreeStyleProject; @@ -23,7 +23,7 @@ import static org.assertj.core.api.Assertions.*; /** - * Integration test for the {@link ModuleDetector}. + * Integration test for the {@link ModuleDetectorRunner}. * *

* These tests work on several pom.xml, build.xml and MANIFEST.MF files that will be copied to the workspace for each