Skip to content
This repository
Browse code

minor changes

  • Loading branch information...
commit b2e93f77e2f5d51e7dd1567b29333289c95f535d 1 parent 155f383
dimitrop dimitrop authored
31 metrics/findbugs/src/main/java/gr/aueb/metrics/findbugs/FindbugsMetrics.java
@@ -131,14 +131,23 @@ public void run(ProjectVersion pv) {
131 131
132 132 String pkgs = getPkgs(pv.getFiles(Pattern.compile("src/main/java/"),
133 133 ProjectVersion.MASK_FILES));
  134 + pkgs = pkgs.substring(0, pkgs.length() - 1);
134 135
135 136 List<String> findbugsArgs = new ArrayList<String>();
136 137 findbugsArgs.add(FINDBUGS_PATH);
137 138 findbugsArgs.add("-textui");
  139 + findbugsArgs.add("-onlyAnalyze");
  140 + findbugsArgs.add(pkgs);
138 141 findbugsArgs.add("-xml");
139   - findbugsArgs.add("-onlyAnalyze"); findbugsArgs.add(pkgs);
140   - findbugsArgs.add("-output"); findbugsArgs.add(pv.getProject().getName() + ".xml");
  142 + findbugsArgs.add("-output");
  143 + // dimitro: I have added a specific path for the output file. You can do that too.
  144 + findbugsArgs.add(
  145 + "/Users/dimitro/Documents/PhD/FindBugs+Alitheia/Alitheia-Core/runner/"+
  146 + pv.getRevisionId()+"-"+pv.getProject().getName() + ".xml");
141 147 findbugsArgs.add(jar.getAbsolutePath());
  148 + //dimitro
  149 + System.out.println("dimitro: the arguments fed to FindBugs are: "+findbugsArgs);
  150 + //dimitro
142 151 ProcessBuilder findbugs = new ProcessBuilder(findbugsArgs);
143 152 findbugs.directory(pom.getParentFile());
144 153 findbugs.redirectErrorStream(true);
@@ -148,7 +157,7 @@ public void run(ProjectVersion pv) {
148 157 log.warn("Build with findbugs failed. See file:" + out);
149 158 }
150 159
151   - File f = new File(pv.getProject().getName() + ".xml");
  160 + File f = new File(pv.getRevisionId()+"-"+pv.getProject().getName() + ".xml");
152 161 parseFindbugsResults(f);
153 162 }
154 163
@@ -173,7 +182,8 @@ public String getPkgs(List<ProjectFile> files) {
173 182 for(ProjectFile f: files) {
174 183 Matcher m = p.matcher(f.getFileName());
175 184 if (m.find()) {
176   - pkgs.add(FileUtils.dirname(m.group(1)).replace('/','.'));
  185 + // dimitro: I have added ".-" as we discussed
  186 + pkgs.add(FileUtils.dirname(m.group(1)).replace('/','.')+".-");
177 187 }
178 188 }
179 189
@@ -272,6 +282,19 @@ public int runReadOutput(Process pr, String name) throws IOException {
272 282 }
273 283 }
274 284 }
  285 +
  286 + //dimitro : Printing the HashMaps values to make sure everything went OK
  287 + Map <String, Map <String, Integer>> testResults = new HashMap <String, Map <String, Integer>> ();
  288 + testResults = resultsMap;
  289 + System.out.println("dimitro: Here come the HashMap's values: ");
  290 + Iterator iterator = testResults.keySet().iterator();
  291 + while (iterator.hasNext()) {
  292 + String key = iterator.next().toString();
  293 + String value = testResults.get(key).toString();
  294 +
  295 + System.out.println(key + " " + value);
  296 + }
  297 + //dimitro
275 298 return resultsMap;
276 299 }
277 300

0 comments on commit b2e93f7

Please sign in to comment.
Something went wrong with that request. Please try again.