public void execute() throws IOException { for (BugInstance bug : origCollection.getCollection()) { for (Iterator<BugAnnotation> i = bug.annotationIterator(); i.hasNext();) { copySourceForAnnotation(i.next()); } } if (zOut != null) { zOut.close(); } System.out.printf("All done. %d files not found, %d files copied%n", couldNotFind.size(), copyCount); }
public void computeBugHashes() { if (preciseHashOccurrenceNumbersAvailable) { return; } invalidateHashes(); HashMap<String, Integer> seen = new HashMap<>(); for (BugInstance bugInstance : getCollection()) { String hash = bugInstance.getInstanceHash(); Integer count = seen.get(hash); if (count == null) { bugInstance.setInstanceOccurrenceNum(0); seen.put(hash, 0); } else { bugInstance.setInstanceOccurrenceNum(count + 1); seen.put(hash, count + 1); } } for (BugInstance bugInstance : getCollection()) { bugInstance.setInstanceOccurrenceMax(seen.get(bugInstance.getInstanceHash())); } preciseHashOccurrenceNumbersAvailable = true; }
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); } }
for (BugInstance bugInstance : getCollection()) { if (!applySuppressions || !project.getSuppressionFilter().match(bugInstance)) { bugInstance.writeXML(xmlOutput, this, withMessages);
static public void merge(HashSet<String> hashes, SortedBugCollection into, SortedBugCollection from) { for (BugInstance bugInstance : from.getCollection()) { if (hashes == null || hashes.add(bugInstance.getInstanceHash())) { into.add(bugInstance); } } ProjectStats stats = into.getProjectStats(); ProjectStats stats2 = from.getProjectStats(); stats.addStats(stats2); Project project = into.getProject(); Project project2 = from.getProject(); project.add(project2); for(AnalysisError error : from.getErrors()) { into.addError(error); } return; }
for (BugInstance warning : bugCollection.getCollection()) { if (!reporter.isApplySuppressions() || !bugCollection.getProject().getSuppressionFilter().match(warning)) { int rank = warning.getBugRank();
if (!commandLine.searchSourcePaths.isEmpty()) { sourceSearcher = new SourceSearcher(project); for (BugInstance bug : origCollection.getCollection()) { SourceLineAnnotation src = bug.getPrimarySourceLineAnnotation(); if (!sourceSearcher.sourceNotFound.contains(src.getClassName()) && !sourceSearcher.findSource(src)) {
assertEquals(1, bc.getCollection().size()); BugInstance bug = bc.getCollection().iterator().next(); assertEquals("MS_MUTABLE_ARRAY", bug.getBugPattern().getType()); assertEquals("1acc5c5b9b7ab9efacede805afe1e53a", bug.getInstanceHash());
+ " </BugInstance>" + "</BugCollection>")); assertEquals(1, bc.getCollection().size()); BugInstance bug = bc.getCollection().iterator().next(); assertEquals("MS_MUTABLE_ARRAY", bug.getBugPattern().getType()); assertEquals("1acc5c5b9b7ab9efacede805afe1e53a", bug.getInstanceHash());
+ " </BugInstance>" + "</BugCollection>")); assertEquals(1, bc.getCollection().size()); BugInstance bug = bc.getCollection().iterator().next(); assertEquals("MS_MUTABLE_ARRAY", bug.getBugPattern().getType()); assertEquals("1acc5c5b9b7ab9efacede805afe1e53a", bug.getInstanceHash());
for (BugInstance bug : origCollection.getCollection()) { if (commandLine.accept(origCollection, bug)) { if (trimToVersion >= 0) { for (BugInstance bug : resultCollection.getCollection()) { bug.clearHistory();
+ " </BugInstance>" + "</BugCollection>")); assertEquals(1, bc.getCollection().size()); assertEquals("edu.umd.cs.findbugs.plugins.core", DetectorFactoryCollection.instance().getCorePlugin().getPluginId()); BugInstance bug = bc.getCollection().iterator().next(); assertEquals("MS_MUTABLE_ARRAY", bug.getBugPattern().getType()); assertEquals("1acc5c5b9b7ab9efacede805afe1e53a", bug.getInstanceHash());
/** * @return Returns true if there were bugs that passed all of the cutoffs. */ public int numScaryBugs() { return scaryBugs.getCollection().size(); }
public void execute() throws IOException { for (BugInstance bug : origCollection.getCollection()) { for (Iterator<BugAnnotation> i = bug.annotationIterator(); i.hasNext();) { copySourceForAnnotation(i.next()); } } if (zOut != null) { zOut.close(); } System.out.printf("All done. %d files not found, %d files copied%n", couldNotFind.size(), copyCount); }
public void computeBugHashes() { if (preciseHashOccurrenceNumbersAvailable) { return; } invalidateHashes(); HashMap<String, Integer> seen = new HashMap<String, Integer>(); for (BugInstance bugInstance : getCollection()) { String hash = bugInstance.getInstanceHash(); Integer count = seen.get(hash); if (count == null) { bugInstance.setInstanceOccurrenceNum(0); seen.put(hash, 0); } else { bugInstance.setInstanceOccurrenceNum(count + 1); seen.put(hash, count + 1); } } for (BugInstance bugInstance : getCollection()) { bugInstance.setInstanceOccurrenceMax(seen.get(bugInstance.getInstanceHash())); } preciseHashOccurrenceNumbersAvailable = true; }
private boolean report() { boolean hasScaryBugs = !scaryBugs.getCollection().isEmpty(); if (hasScaryBugs) { System.out.printf("%4s%n", "days"); if (hasScaryBugs || (options.alwaysShowGui && results.getCollection().size() > 0)) { if (GraphicsEnvironment.isHeadless()) { System.out.println("Running in GUI headless mode, can't open GUI");
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 void report(PrintWriter out) { TreeMap<BugRankCategory, Stats> stats = new TreeMap<BugRankCategory, Stats>(); ProjectStats projectStats = bugCollection.getProjectStats(); Collection<BugInstance> bugs = bugCollection.getCollection(); Cloud cloud = bugCollection.getCloud(); cloud.setMode(Cloud.Mode.COMMUNAL);
static public void merge(HashSet<String> hashes, SortedBugCollection into, SortedBugCollection from) { for (BugInstance bugInstance : from.getCollection()) { if (hashes == null || hashes.add(bugInstance.getInstanceHash())) { into.add(bugInstance); } } ProjectStats stats = into.getProjectStats(); ProjectStats stats2 = from.getProjectStats(); stats.addStats(stats2); Project project = into.getProject(); Project project2 = from.getProject(); project.add(project2); for(AnalysisError error : from.getErrors()) { into.addError(error); } return; }
Collection<BugInstance> bugs = collection.getCollection(); for (BugInstance warning : bugs) { SourceLineAnnotation sourceLine = warning.getPrimarySourceLineAnnotation();