public NewResults(String origFilename, String newFilename) throws IOException, DocumentException { this(new SortedBugCollection(), new SortedBugCollection()); origCollection.readXML(origFilename); newCollection.readXML(newFilename); }
public BugCollectionBugReporter(Project project, @CheckForNull PrintWriter writer) { this.project = project; this.bugCollection = new SortedBugCollection(getProjectStats(), project); bugCollection.setTimestamp(System.currentTimeMillis()); this.writer = writer; } public Project getProject() {
public static void main(String[] args) throws Exception { if (args.length != 1) { System.out.println("Usage: " + PrintAppVersion.class.getName() + " <bug collection>"); System.exit(1); } FindBugs.setNoAnalysis(); SortedBugCollection bugCollection = new SortedBugCollection(); bugCollection.readXML(args[0]); System.out.println(bugCollection.getCurrentAppVersion()); } }
public XDocsBugReporter(Project project) { this.project = project; this.bugCollection = new SortedBugCollection(project); this.document = DocumentHelper.createDocument(); this.root = document.addElement(ROOT_ELEMENT_NAME); }
public SortedBugCollection execute() { SortedBugCollection result = new SortedBugCollection(); for (Iterator<BugInstance> i = newCollection.iterator(); i.hasNext();) { BugInstance bugInstance = i.next(); if (!origCollection.contains(bugInstance)) { result.add(bugInstance); } } return result; }
public static void main(String[] args) throws Exception { if (args.length != 2) { System.err.println("Usage: " + RegenerateClassFeatures.class.getName() + " <bug collection> <jar file>"); System.exit(1); } SortedBugCollection bugCollection = new SortedBugCollection(); bugCollection.readXML(args[0]); new RegenerateClassFeatures(bugCollection, args[1]).execute(); bugCollection.writeXML(System.out); } }
public CopyBuggySource(String[] args) throws Exception { origCollection = new SortedBugCollection(); origCollection.readXML(args[0]); project = origCollection.getProject(); sourceFinder = new SourceFinder(project); src = new File(args[1]); kind = SrcKind.get(src); switch (kind) { case DIR: break; case ZIP: zOut = new ZipOutputStream(new FileOutputStream(src)); break; case Z0P_GZ: zOut = new ZipOutputStream(new DeflaterOutputStream(new FileOutputStream(src))); zOut.setLevel(0); break; } }
@Override public SortedBugCollection createEmptyCollectionWithMetadata() { SortedBugCollection dup = new SortedBugCollection(projectStats.clone(), comparator, project); dup.projectStats.clearBugCounts(); dup.errorList.addAll(this.errorList); dup.missingClassSet.addAll(this.missingClassSet); dup.summaryHTML = this.summaryHTML; dup.classFeatureSetMap.putAll(this.classFeatureSetMap); dup.sequence = this.sequence; dup.analysisVersion = this.analysisVersion; dup.analysisTimestamp = this.analysisTimestamp; dup.timestamp = this.timestamp; dup.releaseName = this.releaseName; for (AppVersion appVersion : appVersionList) { dup.appVersionList.add((AppVersion) appVersion.clone()); } return dup; }
public static void main(String[] args) throws Exception { if (args.length != 1) { System.out.println("Usage: " + ListErrors.class.getName() + " <bug collection>"); System.exit(1); } FindBugs.setNoAnalysis(); SortedBugCollection bugCollection = new SortedBugCollection(); bugCollection.readXML(args[0]); for (AnalysisError e : bugCollection.getErrors()) { String msg = e.getExceptionMessage(); if (msg != null && msg.trim().length() > 0) { System.out.println(e.getMessage() + " : " + msg); } else { System.out.println(e.getMessage()); } } } }
public static void main(String args[]) throws Exception { if (args.length > 1 || (args.length > 0 && "-help".equals(args[0]))) { System.err.println("Usage: " + FileBugHash.class.getName() + " [<infile>]"); System.exit(1); } BugCollection origCollection = new SortedBugCollection(); int argCount = 0; if (argCount == args.length) { origCollection.readXML(System.in); } else { origCollection.readXML(args[argCount]); } FileBugHash result = compute(origCollection); for (String sourceFile : result.getSourceFiles()) { System.out.println(result.getHash(sourceFile) + "\t" + sourceFile); } }
public static Project readXML(File f) throws IOException, SAXException { @SuppressWarnings("resource") // will be closed by caller Project project = new Project(); try (InputStream in = new BufferedInputStream(new FileInputStream(f))) { String tag = Util.getXMLType(in); SAXBugCollectionHandler handler; if ("Project".equals(tag)) { handler = new SAXBugCollectionHandler(project, f); } else if ("BugCollection".equals(tag)) { SortedBugCollection bugs = new SortedBugCollection(project); handler = new SAXBugCollectionHandler(bugs, f); } else { throw new IOException("Can't load a project from a " + tag + " file"); } XMLReader xr = XMLReaderFactory.createXMLReader(); xr.setContentHandler(handler); xr.setErrorHandler(handler); try (Reader reader = Util.getReader(in)) { xr.parse(new InputSource(reader)); } } catch (IOException | SAXException e) { project.close(); throw e; } // Presumably, project is now up-to-date project.setModified(false); return project; }
@SuppressFBWarnings("DM_EXIT") public static void main(String[] args) throws Exception { if (args.length != 2) { System.err.println("Usage: " + AddMessages.class.getName() + " <input collection> <output collection>"); System.exit(1); } // Load plugins, in order to get message files DetectorFactoryCollection.instance(); String inputFile = args[0]; String outputFile = args[1]; Project project = new Project(); SortedBugCollection inputCollection = new SortedBugCollection(project); inputCollection.readXML(inputFile); Document document = inputCollection.toDocument(); AddMessages addMessages = new AddMessages(inputCollection, document); addMessages.execute(); XMLWriter writer = new XMLWriter(new BufferedOutputStream(new FileOutputStream(outputFile)), OutputFormat.createPrettyPrint()); writer.write(document); writer.close(); } }
/** * @param baseline * @throws IOException * @throws DocumentException */ public static void addToExcludedInstanceHashes(Set<String> instanceHashesToExclude, String baseline) throws IOException, DocumentException { Project project = new Project(); BugCollection origCollection; origCollection = new SortedBugCollection(project); origCollection.readXML(baseline); for (BugInstance b : origCollection.getCollection()) { instanceHashesToExclude.add(b.getInstanceHash()); } }
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); } }
public static void main(String[] args) throws Exception { FindBugs.setNoAnalysis(); DetectorFactoryCollection.instance(); // load plugins SortedBugCollection bugCollection = new SortedBugCollection(); int argCount = 0; if (argCount < args.length) { bugCollection.readXML(args[argCount++]); } else { bugCollection.readXML(System.in); } new TreemapVisualization().generateTreeMap(bugCollection); } }
public static void main(String[] args) throws Exception { DetectorFactoryCollection.instance(); // load plugins Churn churn = new Churn(); ChurnCommandLine commandLine = churn.new ChurnCommandLine(); int argCount = commandLine .parse(args, 0, 2, "Usage: " + Churn.class.getName() + " [options] [<xml results> [<history>]] "); SortedBugCollection bugCollection = new SortedBugCollection(); if (argCount < args.length) { bugCollection.readXML(args[argCount++]); } else { bugCollection.readXML(System.in); } churn.setBugCollection(bugCollection); churn.execute(); PrintStream out = System.out; try { if (argCount < args.length) { out = UTF8.printStream(new FileOutputStream(args[argCount++]), true); } churn.dump(out); } finally { out.close(); } } }
+ " [options] [<xml results> [<history>]] "); SortedBugCollection bugCollection = new SortedBugCollection(); if (argCount < args.length) { bugCollection.readXML(args[argCount++]);
public static void main(String[] args) throws Exception { FindBugs.setNoAnalysis(); DetectorFactoryCollection.instance(); // load plugins RebornIssues reborn = new RebornIssues(); CommandLine commandLine = new CommandLine(); int argCount = commandLine.parse(args, 0, 2, "Usage: " + RebornIssues.class.getName() + " [options] [<xml results> [<history>]] "); SortedBugCollection bugCollection = new SortedBugCollection(); if (argCount < args.length) { bugCollection.readXML(args[argCount++]); } else { bugCollection.readXML(System.in); } reborn.setBugCollection(bugCollection); reborn.execute(); } }
SortedBugCollection bugCollection = new SortedBugCollection(); if (argCount < args.length) { bugCollection.readXML(args[argCount++]);
@Test public void testBugInstanceXmlPropsWithReviews() throws Exception { SortedBugCollection bc = new SortedBugCollection(); bc.readXML(new StringReader( "<BugCollection version='1.3.10-dev-20100728' sequence='0' timestamp='1280333223462' analysisTimestamp='1280333224881' release=''>"