}
public List<File> findFiles(File rootDir, String pattern)
throws MoDiException {
if (rootDir == null || pattern == null) {
throw new MoDiException("Neither \"rootDir\" nor \"pattern\" are"
+ "allowed to be null!");
}
List<File> results = new ArrayList<File>();
List<File> workdirs = new ArrayList<File>();
filenameFilter = new FileFinderFilter(pattern);
// we can work on a single file too
if (rootDir.isFile() && rootDir.getAbsolutePath().endsWith(pattern)) {
results.add(rootDir);
return results;
}
// we only work on directories
if (rootDir.isDirectory()) {
this.dir = rootDir;
} else {
throw new MoDiException("Please specify a root directory. I "
+ "found: \"" + rootDir.getAbsolutePath() + "\" not to " + "be a directory.");
}
workdirs.add(dir);// setup for workdir