package net.jaekl.cfb.analyze;
+// Copyright (C) 2015 Christian Jaekl
+
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.MessageFormat;
+import java.util.Date;
import java.util.Locale;
import java.util.Locale.Category;
import net.jaekl.cfb.CfbBundle;
import net.jaekl.cfb.util.Command;
+import net.jaekl.qd.xml.XmlParseException;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
public class Analyzer {
- File m_findbugsDir;
+ MessageMap m_msgMap;
- public Analyzer(File findbugsDir) {
- m_findbugsDir = findbugsDir;
+ public Analyzer(MessageMap msgMap) {
+ m_msgMap = msgMap;
}
- public Analysis analyze(PrintWriter pw, File workDir, File fbp) throws IOException {
- Analysis result = new Analysis();
+ public Analysis analyze(PrintWriter pw, File workDir, File fbp, String projName, String buildNumber)
+ throws IOException, XmlParseException, SAXException
+ {
+ Analysis result = new Analysis(projName, buildNumber);
File fbOutput = outputWorkFile(workDir, fbp);
pw.println(cmdLine);
pw.flush();
Command.Result fbResult = new Command().exec(cmdLine);
+ pw.println("==> " + fbResult.getRetCode());
+ pw.flush();
if (0 != fbResult.getRetCode()) {
// Our attempt to execute FindBugs failed.
// Report the error and return null.
return null;
}
- result = parseFbOutput(fbOutput);
-
+ result.setEnd(new Date());
+ result.parse(new InputSource(fbOutput.getAbsolutePath()));
+ // result.dump(pw);
return result;
}
StringBuilder sb = new StringBuilder();
- sb.append(m_findbugsDir.getAbsolutePath())
+ sb.append(m_msgMap.getFindBugsDir().getAbsolutePath())
.append(File.separator)
.append("bin")
.append(File.separator)
return new File(workPath + File.separator + projName + ".xml");
}
-
- // Parse the output.xml that resulted from a FindBugs run,
- // and store its findings into an Analysis object.
- Analysis parseFbOutput(File fbOutput)
- {
- return null;
- }
}