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 {
21 BugCollection m_bugCollection;
23 Date m_start; // Date/time when analysis was started
26 public Analysis(String buildNumber) {
28 m_bugCollection = null;
29 m_buildNumber = buildNumber;
34 public BugCollection getBugCollection() { return m_bugCollection; }
35 public long getId() { return m_id; }
36 public String getBuildNumber() { return m_buildNumber; }
37 public Date getStart() { return m_start; }
38 public Date getEnd() { return m_end; } // the end time (when FindBugs was done analyzing)
40 public void setBugCollection(BugCollection bugs) { m_bugCollection = bugs; }
41 public void setId(long id) { m_id = id; }
42 public void setStart(Date start) { m_start = start; }
43 public void setEnd(Date date) { m_end = date; }
45 public void parse(InputSource xml) throws FileNotFoundException, IOException, SAXException
47 m_bugCollection = new BugCollection();
49 XMLReader reader = XMLReaderFactory.createXMLReader();
50 ParseHandler ph = new ParseHandler(m_bugCollection);
51 ParseErrorHandler peh = new ParseErrorHandler();
52 reader.setContentHandler(ph);
53 reader.setErrorHandler(peh);
58 public void dump(PrintWriter pw)
60 if (null != m_bugCollection) {
61 m_bugCollection.dump(pw, 2);