Clover Coverage Report - Kuali Spring Utilities 1.1.2-SNAPSHOT
Coverage timestamp: Tue Nov 6 2012 17:56:04 EST
../../../img/srcFileCovDistChart0.png 52% of files have more coverage
23   48   7   7.67
8   44   0.3   3
3     2.33  
1    
 
  ProblemFileDetector       Line # 9 23 0% 7 34 0% 0.0
 
No Tests
 
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   
 
9    public class ProblemFileDetector {
 
10  0 toggle 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   
 
21  0 toggle 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   
 
31  0 toggle 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    }