下面列出了怎么用org.apache.commons.io.filefilter.WildcardFileFilter的API类实例代码及写法,或者点击链接到github查看源代码。
@Parameterized.Parameters(name = "{0}")
public static Collection<Object[]> getTestParameters() throws IOException {
final Collection<Object[]> filenames = new ArrayList<>();
try {
TestDir.actOnAll(TestDir.cdmUnitTestDir + "formats/sigmet/", new WildcardFileFilter("*IRIS"), new TestDir.Act() {
public int doAct(String filename) throws IOException {
filenames.add(new Object[] {filename});
return 1;
}
}, true);
} catch (IOException e) {
// JUnit *always* executes a test class's @Parameters method, even if it won't subsequently run the class's tests
// due to an @Category exclusion. Therefore, we must not let it throw an exception, or else we'll get a build
// failure. Instead, we return a collection containing a nonsense value (to wit, the exception message).
//
// Naturally, if we execute a test using that nonsense value, it'll fail. That's fine; we need to deal with the
// root cause. However, it is more likely that the exception occurred because "!isCdmUnitTestDirAvailable", and
// as a result, all NeedsCdmUnitTest tests will be excluded.
filenames.add(new Object[] {e.getMessage()});
}
return filenames;
}
@Override
public List<File> findFiles(final File directoryToSearch, final List<String> filenamePatterns, final int depth, boolean findInsideMatchingDirectories) {
List<File> found = new ArrayList<>();
for (int i = 0; i <= depth; i++) {
if (files.containsKey(i)) {
List<File> possibles = files.get(i);
for (String pattern : filenamePatterns) {
FileFilter fileFilter = new WildcardFileFilter(pattern);
for (File possible : possibles) {
if (fileFilter.accept(possible)) {
found.add(possible);
}
}
}
}
}
return found;
}
/**
* Determine the number of unprocessed flag files in the flag directory
*
* @param fc
* @return the flag found for this ingest pool
*/
private int countFlagFileBacklog(final FlagDataTypeConfig fc) {
final MutableInt fileCounter = new MutableInt(0);
final FileFilter fileFilter = new WildcardFileFilter("*_" + fc.getIngestPool() + "_" + fc.getDataName() + "_*.flag");
final FileVisitor<java.nio.file.Path> visitor = new SimpleFileVisitor<java.nio.file.Path>() {
@Override
public FileVisitResult visitFile(java.nio.file.Path path, BasicFileAttributes attrs) throws IOException {
if (fileFilter.accept(path.toFile())) {
fileCounter.increment();
}
return super.visitFile(path, attrs);
}
};
try {
Files.walkFileTree(Paths.get(fmc.getFlagFileDirectory()), visitor);
} catch (IOException e) {
// unable to get a flag count....
log.error("Unable to get flag file count", e);
return -1;
}
return fileCounter.intValue();
}
private static URL[] load3(String locationPattern) throws MalformedURLException {
if (StringUtils.contains(locationPattern, PunctuationConstants.STAR.getValue())
|| StringUtils.contains(locationPattern, PunctuationConstants.QUESTION_MARK.getValue())) {
String directoryPath = StringUtils.substringBeforeLast(locationPattern,
ResourceConstants.FOLDER_SEPARATOR.getValue());
directoryPath = StringUtils.substringAfter(directoryPath, ResourceConstants.FILE_URL_PREFIX.getValue());
File directory = new File(directoryPath);
String filePattern = StringUtils.substringAfter(locationPattern,
ResourceConstants.FOLDER_SEPARATOR.getValue());
while (filePattern.contains(ResourceConstants.FOLDER_SEPARATOR.getValue())) {
filePattern = StringUtils.substringAfter(filePattern, ResourceConstants.FOLDER_SEPARATOR.getValue());
}
Set<URL> result = new LinkedHashSet<URL>(16);
Iterator<File> iterator = FileUtils.iterateFiles(directory, new WildcardFileFilter(filePattern), null);
while (iterator.hasNext()) {
result.add(iterator.next().toURI().toURL());
}
return result.toArray(new URL[result.size()]);
} else {
// a single resource with the given name
URL url = new URL(locationPattern);
return new File(url.getFile()).exists() ? new URL[] { url } : null;
}
}
private void copyImagesAndCertificates(String origConfigFile, TestContext context) {
File sourceDir = new File(origConfigFile).getParentFile();
if(!sourceDir.exists()) {
sourceDir = new File(ImportTestAction.class.getResource(origConfigFile).getFile()).getParentFile();
if(!sourceDir.exists()) {
return;
}
}
FileFilter filter = new WildcardFileFilter(new String[] {"*.crt", "*.jpg", "*.png", "*.pem"});
try {
LOG.info("Copy certificates and images from source: "+sourceDir+" into test-dir: '"+testDir+"'");
FileUtils.copyDirectory(sourceDir, testDir, filter);
} catch (IOException e) {
}
}
private static List<File> classpath(File o2oadir, File outputdir) {
List<File> cp = new ArrayList<>();
cp.add(outputdir);
IOFileFilter filter = new WildcardFileFilter("x_base_core_project.jar");
for (File o : FileUtils.listFiles(new File(o2oadir, "o2server/store/jars"), filter, null)) {
cp.add(o);
}
ClassLoader cl = MetaModelBuilder.class.getClassLoader();
URL[] urls = ((URLClassLoader) cl).getURLs();
for (URL url : urls) {
cp.add(new File(url.getFile()));
}
return cp;
}
private void customJar(String simpleName, byte[] bytes) throws Exception {
File jar = new File(Config.dir_custom_jars(true), simpleName + ".jar");
FileUtils.writeByteArrayToFile(jar, bytes, false);
List<String> contexts = new ArrayList<>();
for (String s : Config.dir_custom().list(new WildcardFileFilter("*.war"))) {
contexts.add("/" + FilenameUtils.getBaseName(s));
}
if (Servers.applicationServerIsRunning()) {
GzipHandler gzipHandler = (GzipHandler) Servers.applicationServer.getHandler();
HandlerList hanlderList = (HandlerList) gzipHandler.getHandler();
for (Handler handler : hanlderList.getHandlers()) {
if (QuickStartWebApp.class.isAssignableFrom(handler.getClass())) {
QuickStartWebApp app = (QuickStartWebApp) handler;
if (contexts.contains(app.getContextPath())) {
app.stop();
Thread.sleep(2000);
app.start();
}
}
}
}
}
public static File[] getTempOutputImageIterations(File outputImage) {
// Unix-like searching for image iterations
String outputImageBase = getFileName(outputImage);
FileFilter fileFilter = new WildcardFileFilter(String.format("%s_*.png", outputImageBase));
File[] files = NeuralStyleWrapper.getWorkingFolder().listFiles(fileFilter);
// sort the files by the iteration progress
if (files != null && files.length > 1) {
int[] fileIters = new int[files.length];
for (int i = 0; i < files.length; i++)
fileIters[i] = FileUtils.parseImageIteration(files[i]);
FileUtils.quickSort(fileIters, files, 0, files.length - 1);
// if the latest file was still being written to during the check
// then replace it with the previous file (set will remove it)
if (isFileBeingWritten(files[files.length - 1]))
files[files.length - 1] = files[files.length - 2];
}
return files;
}
@Override
public List<MagicCardStock> listStocks(MagicCard mc, MagicCollection col,boolean editionStrict) throws SQLException {
List<MagicCardStock> st = new ArrayList<>();
File f = new File(directory, STOCKDIR);
for (File fstock : FileUtils.listFiles(f, new WildcardFileFilter("*" + IDGenerator.generate(mc)),TrueFileFilter.INSTANCE)) {
try {
MagicCardStock s = read(MagicCardStock.class, fstock);
if (s.getMagicCollection().getName().equals(col.getName()))
st.add(s);
} catch (Exception e) {
throw new SQLException(e);
}
}
return st;
}
@Test
public void testSpoonGoalWithAProcessor() throws Exception {
File basedir = resources.getBasedir("processor");
rule.executeMojo(basedir, "generate");
final File dirOutputResults = new File(basedir, "target/spoon-maven-plugin");
assertThat(dirOutputResults).exists();
final WildcardFileFilter filter = new WildcardFileFilter("result-spoon-*.xml");
final File[] files = dirOutputResults.listFiles((FileFilter) filter);
assertThat(files.length).isEqualTo(1);
assertThat(files[0].getName()).startsWith("result-spoon");
final File resultFileProcessor = new File(basedir, "target/spoon-maven-plugin/spoon-nb-statement.txt");
assertThat(resultFileProcessor).exists();
}
@Test
public void testSpoonGoalWithCustomPConfiguration() throws Exception {
File basedir = resources.getBasedir("custom-configuration");
rule.executeMojo(basedir, "generate");
final File dirOutputResults = new File(basedir, "target/spoon-maven-plugin");
assertThat(dirOutputResults).exists();
final WildcardFileFilter filter = new WildcardFileFilter("result-spoon-*.xml");
final File[] files = dirOutputResults.listFiles((FileFilter) filter);
assertThat(files.length).isEqualTo(1);
assertThat(files[0].getName()).startsWith("result-spoon");
File generateFiles = new File(basedir, "target/generate-source-with-spoon");
assertThat(generateFiles).exists();
}
@Test
public void testSpoonCheckGoalWithTest() throws Exception {
File basedir = resources.getBasedir("hello-world-with-test");
rule.executeMojo(basedir, "check");
final File dirOutputResults = new File(basedir, "target/spoon-maven-plugin");
assertThat(dirOutputResults).exists();
final File contentSource = new File(basedir, "target/generated-sources/spoon/fr/inria/gforge/spoon");
assertThat(contentSource).doesNotExist();
final WildcardFileFilter filter = new WildcardFileFilter("result-spoon-*.xml");
final File[] files = dirOutputResults.listFiles((FileFilter) filter);
assertThat(files.length).isEqualTo(1);
assertThat(files[0].getName()).startsWith("result-spoon");
}
private static URL[] load2(String locationPattern) throws URISyntaxException, IOException {
String location = locationPattern.substring(ResourceConstants.CLASSPATH_URL_PREFIX.getValue().length());
if (location.startsWith(ResourceConstants.FOLDER_SEPARATOR.getValue())) {
location = location.substring(1);
}
String cleanPath = PathUtils.cleanPath(location);
// 只支持文件的通配符匹配,不支持文件夹的通配符匹配
// 如需实现文件夹的通配符匹配,请参照spring.utils包,较复杂
if (StringUtils.contains(cleanPath, PunctuationConstants.STAR.getValue())
|| StringUtils.contains(cleanPath, PunctuationConstants.QUESTION_MARK.getValue())) {
String directoryPath = StringUtils.substringBeforeLast(locationPattern,
ResourceConstants.FOLDER_SEPARATOR.getValue());
File directory = new File(ResourceUtils.loadResource(directoryPath).toURI().getPath());
String filePattern = StringUtils.substringAfter(cleanPath, ResourceConstants.FOLDER_SEPARATOR.getValue());
while (filePattern.contains(ResourceConstants.FOLDER_SEPARATOR.getValue())) {
filePattern = StringUtils.substringAfter(filePattern, ResourceConstants.FOLDER_SEPARATOR.getValue());
}
Set<URL> result = new LinkedHashSet<URL>(16);
Iterator<File> iterator = FileUtils.iterateFiles(directory, new WildcardFileFilter(filePattern), null);
while (iterator.hasNext()) {
result.add(iterator.next().toURI().toURL());
}
return result.toArray(new URL[result.size()]);
} else {
// a single resource with the given name
URL url = getDefaultClassLoader().getResource(cleanPath);
// if (url == null) {
// throw new UnsupportedOperationException(cleanPath);
// }
return url == null ? null : new URL[] { PathUtils.cleanPath(url) };
}
}
public static Collection<File> expandWildcardFile(final File wildcardFile) {
final String fileName = wildcardFile.getName();
if (fileName.contains("*") || fileName.contains("?"))
return FileUtils.listFiles(wildcardFile.getParentFile(), new WildcardFileFilter(wildcardFile.getName()), null);
else
return Collections.singleton(wildcardFile);
}
private static List<String> listCustom() throws Exception {
List<String> list = new ArrayList<>();
for (String str : Config.dir_custom(true).list(new WildcardFileFilter("*.war"))) {
list.add(FilenameUtils.getBaseName(str));
}
list = ListTools.includesExcludesWildcard(list, Config.currentNode().getApplication().getIncludes(),
Config.currentNode().getApplication().getExcludes());
return list;
}
@Override
public void run() {
super.run();
String directoryPath = readStringArgument("directory");
String pattern = readStringArgument("pattern", "*");
// Some valid orderBy values: "date", "date, desc", "name", "size"
String orderBy = readStringArgument("orderBy", "name");
List<File> files;
File directory = new File(directoryPath);
if (directory.exists()) {
FileFilter fileFilter = new WildcardFileFilter(pattern);
files = Arrays.asList(directory.listFiles(fileFilter));
} else {
log.warning(String.format("Directory \"%s\" doesn't exist", directoryPath));
files = new ArrayList<File>(0);
}
if (orderBy != null) {
if (orderBy.matches("^\\s*date.*")) {
files = files.stream().sorted(Comparator.comparing(File::lastModified)).collect(Collectors.toList());
} else if (orderBy.matches("^\\s*name.*")) {
files = files.stream().sorted(Comparator.comparing(File::getName)).collect(Collectors.toList());
} else if (orderBy.matches("^\\s*size.*")) {
files = files.stream().sorted(Comparator.comparing(File::length)).collect(Collectors.toList());
}
if (orderBy.matches(".*,\\s*desc\\s*$")) {
Collections.reverse(files);
}
}
this.writeOutput("files", files);
if (files.size() > 0) {
this.writeOutput("firstFile", files.size() > 0 ? files.get(0) : null);
this.writeOutput("lastFile", files.size() > 0 ? files.get(files.size() - 1) : null);
}
}
/**
* Primitive DB comparison method
* We just compare file names, not the subdirectory structure also
* (so this would fail if multiple subdirectories had the same file name)
*/
public static void assertDirectoriesEqual(File expected, File actual, boolean ignoreWhitespace) {
MutableList<File> expectedFiles = FastList.newList(FileUtils.listFiles(expected, new WildcardFileFilter("*"),
DIR_FILE_FILTER));
expectedFiles = expectedFiles.sortThisBy(toRelativePath(expected));
MutableList<File> actualFiles = FastList.newList(FileUtils.listFiles(actual, new WildcardFileFilter("*"),
DIR_FILE_FILTER));
actualFiles = actualFiles.sortThisBy(toRelativePath(actual));
assertEquals(
String.format("Directories did not have same # of files:\nExpected: %1$s\nbut was: %2$s",
expectedFiles.makeString("\n"), actualFiles.makeString("\n")),
expectedFiles.size(), actualFiles.size());
for (int i = 0; i < expectedFiles.size(); i++) {
File expectedFile = expectedFiles.get(i);
File actualFile = actualFiles.get(i);
String expectedFilePath = getRelativePath(expectedFile, expected);
String actualFilePath = getRelativePath(actualFile, actual);
LOG.info("Comparing {} vs {}", expectedFilePath, actualFilePath);
assertEquals("File " + i + " [" + expectedFile + " vs " + actualFile
+ " does not match paths relative from their roots", expectedFilePath, actualFilePath);
if (ignoreWhitespace) {
String expectedContent = FileUtilsCobra.readFileToString(expectedFile);
String actualContent = FileUtilsCobra.readFileToString(actualFile);
assertThat(actualContent, Matchers.equalToIgnoringWhiteSpace(expectedContent));
} else {
FileAssert.assertEquals("Mismatch on file " + expectedFile.getAbsolutePath(), expectedFile, actualFile);
}
}
}
/**
* Create a ModuleOverrides object which will process the modules according to the given options.
*
* @param includeFields - List of field names to include
* @param includeModulesList - list of module filename rules to include
* @param excludeFields - list of field names to exclude
* @param excludeModulesList - list of module filename rules to exclude
*/
public ModuleOverrides(List<String> includeFields, List<String> includeModulesList,
List<String> excludeFields, List<String> excludeModulesList) {
this.includeFields = includeFields;
this.excludeFields = excludeFields;
if (includeModulesList != null) {
this.includeModules = new WildcardFileFilter(includeModulesList, IOCase.INSENSITIVE);
}
if (excludeModulesList != null) {
this.excludeModules = new WildcardFileFilter(excludeModulesList, IOCase.INSENSITIVE);
}
}
private Predicate<String> getModulePredicate() {
if (options.enabledModules == null) {
return path -> true;
}
FilenameFilter filenameFilter = new WildcardFileFilter(options.enabledModules,
IOCase.INSENSITIVE);
return path -> filenameFilter.accept(null, path);
}
public static File getFile(File dir, String fileType) throws FileNotFoundException {
if (fileType.equals(FILE_TYPE_METADATA))
return getMetadataFile(dir);
// FileMetadata metadata = MetadataParser.parseMetadata(dir);
//
// // if fileType = browser and original file is browser compatible then return original file:
// if (fileType.equals(FImagestoreVars.FILE_TYPE_BROWSER) &&
// MimeTypes.isImageMimeTypeBrowserCompatible(metadata.Mimetype)) {
//// return getOrigFile(dir);
// fileType=FImagestoreVars.FILE_TYPE_ORIG;
// }
// // else if fileType = view and original file is binarized then return original file:
// if (fileType.equals(ImagestoreVars.FILE_TYPE_VIEW) && metadata.imgMetadata.NComponents==1) {
// return getOrigFile(dir);
// }
// else: get file of type fileType:
// List<File> files = (List<File>) FileUtils.listFiles(dir, new WildcardFilter(fileType+"_*.*"), null);
List<File> files = (List<File>) FileUtils.listFiles(dir, new WildcardFileFilter(fileType+"_*.*"), null);
if (files.size()==0)
throw new FileNotFoundException("File of type "+fileType+" not found in dir: "+dir.getAbsolutePath());
else if (files.size()>1)
throw new FileNotFoundException("File of type "+fileType+" is duplicate in dir: "+dir.getAbsolutePath());
else
return files.get(0);
}
@Ignore
@Test
public void testAppUpdate() throws InterruptedException {
String[] args = {"-updateApp"};
ModpackDownloaderCLI.main(args);
FileFilter fileFilter = new WildcardFileFilter("ModpackDownloader*jar");
File directory = new File(".");
List<File> files = Arrays.asList(directory.listFiles(fileFilter));
Assert.assertTrue(!CollectionUtils.isEmpty(files));
files.forEach(File::deleteOnExit);
}
/**
* Does necessary actions to run an example/user's workflow.
* @param moduleName name of user module in which workflow code is present
* @param workflowClassFQN fully qualified name of main class which triggers user workflow execution at client side.
* @see com.flipkart.flux.examples.concurrent.RunEmailMarketingWorkflow for example.
* @param configFileName "flux_config.yml" which contains workflow related configuration.
* @see flux/examples/src/main/resources/flux_config.yml for example.
* @throws Exception
*/
private static void runExample(String moduleName, String workflowClassFQN, String configFileName, String mavenPath) throws Exception {
//copy dependencies to module's target directory
executeCommand(mavenPath+" -pl " + moduleName + " -q package dependency:copy-dependencies -DincludeScope=runtime -DskipTests");
//get deployment path from configuration.yml
FileReader reader = new FileReader(WorkflowExecutionDemo.class.getResource("/packaged/configuration.yml").getFile());
String deploymentUnitsPath = (String) ((Map)new Yaml().load(reader)).get("deploymentUnitsPath");
if(!deploymentUnitsPath.endsWith("/")) {
deploymentUnitsPath = deploymentUnitsPath + "/";
}
reader.close();
//create deployment structure
String deploymentUnitName = "DU1/1";
String mainDirPath = deploymentUnitsPath + deploymentUnitName + "/main";
String libDirPath = deploymentUnitsPath + deploymentUnitName + "/lib";
executeCommand("mkdir -p " + mainDirPath);
executeCommand("mkdir -p " + libDirPath);
//copy dependencies to deployment unit
FileUtils.copyFile(new File(moduleName + "/target/").listFiles((FilenameFilter) new WildcardFileFilter(moduleName + "*.jar"))[0], new File(mainDirPath + "/" + moduleName + ".jar"));
FileUtils.copyDirectory(new File(moduleName + "/target/dependency"), new File(libDirPath));
FileUtils.copyFile(new File(moduleName + "/src/main/resources/" + configFileName), new File(deploymentUnitsPath + deploymentUnitName + "/flux_config.yml"));
//start flux runtime
FluxInitializer.main(new String[]{});
//Invoke workflow in separate process, the below system out prints this process's output in blue color
System.out.println((char)27 + "[34m"+executeCommand("java -cp " + moduleName +"/target/*:" + moduleName + "/target/dependency/* " + workflowClassFQN) + (char)27 + "[0m");
}
protected Log[] getPastLogs(final String liveLog) throws IOException {
final File dir = new File(FilenameUtils.getFullPathNoEndSeparator(liveLog));
final String pastPattern = FilenameUtils.getName(liveLog) + getPastLogsSuffixPattern();
final FileFilter fileFilter = new WildcardFileFilter(pastPattern);
final File[] files = dir.listFiles(fileFilter);
final FileLog[] logs = new FileLog[files.length];
Arrays.sort(files, getPastLogsType().getPastComparator());
int i = 0;
for (final File file : files) {
// TODO Decouple direct file log association
logs[i++] = new FileLog(file);
}
logger.debug("Found {} past logs for {} with pattern {}", logs.length, liveLog, pastPattern);
return logs;
}
public static File getCoprocessorJarFile() {
String projectRootDir = System.getProperty("user.dir");
String targetDirPath = projectRootDir + "/target/";
File targetDirFile = new File(targetDirPath);
if (!targetDirFile.exists()) {
throw new IllegalStateException(targetDirPath + " not found, please execute 'mvn install -DskipTests' under " + projectRootDir + " to build the project firstly and retry");
}
String jarFileNameWildCard = "eagle-storage-hbase-*-coprocessor.jar";
Collection<File> jarFiles = FileUtils.listFiles(targetDirFile, new WildcardFileFilter(jarFileNameWildCard), TrueFileFilter.INSTANCE);
if (jarFiles.size() == 0) {
throw new IllegalStateException("jar is not found, please execute 'mvn package -DskipTests' from project root firstly and retry");
}
return jarFiles.iterator().next();
}
/**
* Given a wildcard pattern as string, return an array of files matching that pattern.
*
* @param pattern wildcard pattern to match
* @return array of files
* @throws IllegalArgumentException on bad pattern
*/
private static File[] getFilesByPattern(String pattern) throws IllegalArgumentException {
if (!pattern.contains("*") && !pattern.contains("?")) {
throw new IllegalArgumentException(wildcardError);
}
FileFilter fileFilter = new WildcardFileFilter(pattern);
File[] files = new File(".").listFiles(fileFilter);
if (files == null || files.length < 1) {
// Warn user, but continue (empty input checked later)
logger.error("No files match pattern: {}", pattern);
}
return files;
}
private List<Path> resolveIncludePattern(String includePattern) {
if (includePattern.contains("*")) {
String[] dirs = includePattern.split(File.separator);
String pattern = dirs[dirs.length - 1];
File basedir = new File(mavenProject.getBasedir(), includePattern.replace(pattern, ""));
return FileUtils
.listFiles(basedir, new WildcardFileFilter(pattern), null)
.stream()
.map(File::toPath)
.collect(Collectors.toList());
} else {
return Collections.singletonList(mavenProject.getBasedir().toPath().resolve(includePattern));
}
}
public static Collection<File> getPomFiles( File repoPath )
{
Collection<File> pomFiles = new ArrayList<File>();
Collection<File> leafDirectories = getLeafDirectories( repoPath );
for ( File leafDirectory : leafDirectories )
{
IOFileFilter fileFilter = new AndFileFilter( new WildcardFileFilter( "*.pom" ),
new NotFileFilter( new SuffixFileFilter( "sha1" ) ) );
pomFiles.addAll( FileUtils.listFiles( leafDirectory, fileFilter, null ) );
}
return pomFiles;
}
private File findFile( File dir, String pattern ) {
File file = null;
FileFilter filter = new WildcardFileFilter( pattern );
File[] files = dir.listFiles(filter);
if( files != null && files.length > 0 ) {
file = files[0];
}
return file;
}
private String[] getSnapshotsList(CacheRefreshConfiguration cacheRefreshConfiguration) {
File file = new File(cacheRefreshConfiguration.getSnapshotFolder());
String[] files = file.list(new WildcardFileFilter(String.format(SNAPSHOT_FILE_NAME_PATTERN, "*")));
Arrays.sort(files);
return files;
}
private Map<Integer, String> prepareLogFiles() {
Map<Integer, String> logFiles = new HashMap<Integer, String>();
int fileIndex = 0;
for (SimpleCustomProperty logTemplate : this.logViewerConfiguration.getLogTemplates()) {
String logTemplatePattern = logTemplate.getValue2();
if (StringHelper.isEmpty(logTemplatePattern)) {
continue;
}
String logTemplatePath = FilenameUtils.getFullPath(logTemplatePattern);
String logTemplateFile = FilenameUtils.getName(logTemplatePattern);
File logTemplateBaseDir = new File(logTemplatePath);
FileFilter fileFilter = new AndFileFilter(FileFileFilter.FILE, new WildcardFileFilter(logTemplateFile));
File[] files = logTemplateBaseDir.listFiles(fileFilter);
if (files == null) {
continue;
}
for (int i = 0; i < files.length; i++) {
logFiles.put(fileIndex++, files[i].getPath());
}
}
return logFiles;
}