1 19 20 package edu.umd.cs.findbugs; 21 22 import java.util.Iterator ; 23 24 import edu.umd.cs.findbugs.classfile.ClassDescriptor; 25 26 30 public class SortingBugReporter extends TextUIBugReporter { 31 private SortedBugCollection bugCollection = new SortedBugCollection(); 32 33 public void observeClass(ClassDescriptor classDescriptor) { 34 } 37 38 @Override 39 public void doReportBug(BugInstance bugInstance) { 40 if (bugCollection.add(bugInstance)) 41 notifyObservers(bugInstance); 42 } 43 44 public void finish() { 45 Iterator <BugInstance> i = bugCollection.iterator(); 46 while (i.hasNext()) { 47 BugInstance bugInstance = i.next(); 48 printBug(bugInstance); 49 } 50 51 outputStream.close(); 52 } 53 } 54 55 | Popular Tags |