public final void reportBugsFromXml(@WillClose InputStream in, Project theProject) throws IOException, DocumentException { SortedBugCollection theCollection = new SortedBugCollection(theProject); theCollection.readXML(in); for (BugInstance bug : theCollection.getCollection()) { doReportBug(bug); } }
private SortedBugCollection readXml(final InputStream file) throws IOException, DocumentException { SaxSetup sax = new SaxSetup(); ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(FindBugsParser.class.getClassLoader()); SortedBugCollection collection = new SortedBugCollection(); collection.readXML(file); return collection; } finally { Thread.currentThread().setContextClassLoader(contextClassLoader); sax.cleanup(); } }