Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #78 upgraded Commons-io #81

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,9 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
<version>2.16.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package com.adobe.campaign.tests.logparser.core;

import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
Expand Down Expand Up @@ -253,8 +254,10 @@ public static List<String> findFilePaths(String in_rootDir, String in_fileFilter
throw new IllegalArgumentException("The given root path " + in_rootDir + " is not a directory.");
}

Iterator<File> l_foundFilesIterator = FileUtils.iterateFiles(l_rootDir, new WildcardFileFilter(in_fileFilter),
TrueFileFilter.INSTANCE);
Iterator<File> l_foundFilesIterator = FileUtils.iterateFiles(l_rootDir,WildcardFileFilter.builder().setWildcards(in_fileFilter).get(), TrueFileFilter.INSTANCE);

FileFilter fileFilter = WildcardFileFilter.builder().setWildcards(in_fileFilter).get();

List<String> l_foundFilesList = new ArrayList<>();
l_foundFilesIterator.forEachRemaining(f -> l_foundFilesList.add(f.getAbsolutePath()));
log.info("Searching within the {} matching files :", l_foundFilesList.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1278,10 +1278,19 @@ public void testFileSearch_negative2() {
}

@Test
public void testFileSearch_negative3() {
String l_fileFilter=null;
public void testFileSearch_null() {
String l_fileFilter = null;
String l_rootPath = "src/test/resources/nestedDirs";
Assert.assertThrows(IllegalArgumentException.class, () -> LogDataFactory.findFilePaths(l_rootPath, l_fileFilter));
assertThat("An empty or null filter should not return enything",
LogDataFactory.findFilePaths(l_rootPath, l_fileFilter), Matchers.empty());
}

@Test
public void testFileSearch_empty() {
String l_fileFilter = "";
String l_rootPath = "src/test/resources/nestedDirs";
assertThat("An empty or null filter should not return enything",
LogDataFactory.findFilePaths(l_rootPath, l_fileFilter), Matchers.empty());
}

@Test
Expand Down
Loading