}
public boolean accept(InputFile inputFile, InputFile.Type type) {
- PathPattern[] inclusionPatterns = null;
- PathPattern[] exclusionPatterns = null;
+ PathPattern[] inclusionPatterns;
+ PathPattern[] exclusionPatterns;
if (InputFile.Type.MAIN == type) {
inclusionPatterns = mainInclusions;
exclusionPatterns = mainExclusions;
} else if (InputFile.Type.TEST == type) {
inclusionPatterns = testInclusions;
exclusionPatterns = testExclusions;
+ } else {
+ throw new IllegalArgumentException("Unknown file type: " + type);
}
+
if (inclusionPatterns.length > 0) {
boolean matchInclusion = false;
for (PathPattern pattern : inclusionPatterns) {
Collection<File> files = FileUtils.listFiles(dirToIndex, FILE_FILTER, DIR_FILTER);
for (File file : files) {
DefaultInputFile inputFile = inputFileBuilder.create(file);
- if (inputFile != null) {
- if (exclusionFilters.accept(inputFile, type)) {
- indexFile(inputFileBuilder, fileSystem, status, inputFile, type);
- }
+ if (inputFile != null && exclusionFilters.accept(inputFile, type))
+ indexFile(inputFileBuilder, fileSystem, status, inputFile, type);
}
- }
}
private void indexFile(InputFileBuilder inputFileBuilder, DefaultModuleFileSystem fs,