1 package net.jaekl.cfb.analyze;
3 // Copyright (C) 2015 Christian Jaekl
5 import java.io.FileNotFoundException;
6 import java.io.IOException;
7 import java.io.PrintWriter;
10 import net.jaekl.cfb.xml.BugCollection;
11 import net.jaekl.qd.xml.ParseErrorHandler;
12 import net.jaekl.qd.xml.ParseHandler;
14 import org.xml.sax.InputSource;
15 import org.xml.sax.SAXException;
16 import org.xml.sax.XMLReader;
17 import org.xml.sax.helpers.XMLReaderFactory;
19 public class Analysis {
20 BugCollection m_bugCollection;
22 Date m_start; // Date/time when analysis was started
25 public Analysis(String buildNumber) {
26 m_bugCollection = null;
27 m_buildNumber = buildNumber;
32 public BugCollection getBugCollection() { return m_bugCollection; }
33 public String getBuildNumber() { return m_buildNumber; }
34 public Date getStart() { return m_start; }
35 public Date getEnd() { return m_end; }
37 public void parse(InputSource xml) throws FileNotFoundException, IOException, SAXException
39 m_bugCollection = new BugCollection();
41 XMLReader reader = XMLReaderFactory.createXMLReader();
42 ParseHandler ph = new ParseHandler(m_bugCollection);
43 ParseErrorHandler peh = new ParseErrorHandler();
44 reader.setContentHandler(ph);
45 reader.setErrorHandler(peh);
49 // Set the end time (when FindBugs was done analyzing)
50 public void setEnd(Date date)
55 public void dump(PrintWriter pw)
57 if (null != m_bugCollection) {
58 m_bugCollection.dump(pw, 2);