1 |
|
package org.springframework.beans; |
2 |
|
|
3 |
|
import java.io.File; |
4 |
|
import java.io.FileFilter; |
5 |
|
import java.io.IOException; |
6 |
|
import java.util.ArrayList; |
7 |
|
import java.util.List; |
8 |
|
|
|
|
| 0% |
Uncovered Elements: 34 (34) |
Complexity: 7 |
Complexity Density: 0.3 |
|
9 |
|
public class ProblemFileDetector { |
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
10 |
0
|
public List<File> getProblemFiles(ProblemFileContext context) throws IOException {... |
11 |
0
|
File baseDir = context.getBaseDir(); |
12 |
0
|
FileFilter exclude = context.getExclude(); |
13 |
0
|
FileFilter include = context.getInclude(); |
14 |
0
|
FileFilter problem = context.getProblem(); |
15 |
0
|
List<File> files = getFiles(baseDir, exclude, include); |
16 |
0
|
System.out.println("Located " + files.size() + " total files"); |
17 |
0
|
List<File> problemFiles = getProblemFiles(files, problem); |
18 |
0
|
return problemFiles; |
19 |
|
} |
20 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
21 |
0
|
protected List<File> getProblemFiles(List<File> files, FileFilter problem) throws IOException {... |
22 |
0
|
List<File> problemFiles = new ArrayList<File>(); |
23 |
0
|
for (File file : files) { |
24 |
0
|
if (problem.accept(file)) { |
25 |
0
|
problemFiles.add(file); |
26 |
|
} |
27 |
|
} |
28 |
0
|
return problemFiles; |
29 |
|
} |
30 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 4 |
Complexity Density: 0.4 |
|
31 |
0
|
protected List<File> getFiles(File dir, FileFilter exclude, FileFilter include) {... |
32 |
0
|
File[] contents = dir.listFiles(); |
33 |
0
|
List<File> files = new ArrayList<File>(); |
34 |
0
|
for (File file : contents) { |
35 |
0
|
if (!exclude.accept(file)) { |
36 |
0
|
continue; |
37 |
|
} |
38 |
0
|
if (file.isDirectory()) { |
39 |
0
|
files.addAll(getFiles(file, exclude, include)); |
40 |
|
} else { |
41 |
0
|
if (include.accept(file)) { |
42 |
0
|
files.add(file); |
43 |
|
} |
44 |
|
} |
45 |
|
} |
46 |
0
|
return files; |
47 |
|
} |
48 |
|
} |