Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

minor changes

  • Loading branch information...
commit b2e93f77e2f5d51e7dd1567b29333289c95f535d 1 parent 155f383
@dimitrop dimitrop authored
View
31 metrics/findbugs/src/main/java/gr/aueb/metrics/findbugs/FindbugsMetrics.java
@@ -131,14 +131,23 @@ public void run(ProjectVersion pv) {
String pkgs = getPkgs(pv.getFiles(Pattern.compile("src/main/java/"),
ProjectVersion.MASK_FILES));
+ pkgs = pkgs.substring(0, pkgs.length() - 1);
List<String> findbugsArgs = new ArrayList<String>();
findbugsArgs.add(FINDBUGS_PATH);
findbugsArgs.add("-textui");
+ findbugsArgs.add("-onlyAnalyze");
+ findbugsArgs.add(pkgs);
findbugsArgs.add("-xml");
- findbugsArgs.add("-onlyAnalyze"); findbugsArgs.add(pkgs);
- findbugsArgs.add("-output"); findbugsArgs.add(pv.getProject().getName() + ".xml");
+ findbugsArgs.add("-output");
+ // dimitro: I have added a specific path for the output file. You can do that too.
+ findbugsArgs.add(
+ "/Users/dimitro/Documents/PhD/FindBugs+Alitheia/Alitheia-Core/runner/"+
+ pv.getRevisionId()+"-"+pv.getProject().getName() + ".xml");
findbugsArgs.add(jar.getAbsolutePath());
+ //dimitro
+ System.out.println("dimitro: the arguments fed to FindBugs are: "+findbugsArgs);
+ //dimitro
ProcessBuilder findbugs = new ProcessBuilder(findbugsArgs);
findbugs.directory(pom.getParentFile());
findbugs.redirectErrorStream(true);
@@ -148,7 +157,7 @@ public void run(ProjectVersion pv) {
log.warn("Build with findbugs failed. See file:" + out);
}
- File f = new File(pv.getProject().getName() + ".xml");
+ File f = new File(pv.getRevisionId()+"-"+pv.getProject().getName() + ".xml");
parseFindbugsResults(f);
}
@@ -173,7 +182,8 @@ public String getPkgs(List<ProjectFile> files) {
for(ProjectFile f: files) {
Matcher m = p.matcher(f.getFileName());
if (m.find()) {
- pkgs.add(FileUtils.dirname(m.group(1)).replace('/','.'));
+ // dimitro: I have added ".-" as we discussed
+ pkgs.add(FileUtils.dirname(m.group(1)).replace('/','.')+".-");
}
}
@@ -272,6 +282,19 @@ public int runReadOutput(Process pr, String name) throws IOException {
}
}
}
+
+ //dimitro : Printing the HashMaps values to make sure everything went OK
+ Map <String, Map <String, Integer>> testResults = new HashMap <String, Map <String, Integer>> ();
+ testResults = resultsMap;
+ System.out.println("dimitro: Here come the HashMap's values: ");
+ Iterator iterator = testResults.keySet().iterator();
+ while (iterator.hasNext()) {
+ String key = iterator.next().toString();
+ String value = testResults.get(key).toString();
+
+ System.out.println(key + " " + value);
+ }
+ //dimitro
return resultsMap;
}
Please sign in to comment.
Something went wrong with that request. Please try again.