edu.umd.cs.findbugs
Class AbstractBugReporter

java.lang.Object
  extended by edu.umd.cs.findbugs.AbstractBugReporter
All Implemented Interfaces:
ClassObserver, RepositoryLookupFailureCallback, BugReporter
Direct Known Subclasses:
AnalysisRun.Reporter, TextUIBugReporter

public abstract class AbstractBugReporter
extends java.lang.Object
implements BugReporter

An abstract class which provides much of the functionality required of all BugReporter objects.


Field Summary
private  FindBugs engine
           
private  java.util.LinkedList<java.lang.String> errorMessageList
           
private  java.util.LinkedList<java.lang.String> missingClassMessageList
           
private  java.util.HashSet<java.lang.String> missingClassMessageSet
           
private  java.util.List<BugReporterObserver> observerList
           
private  int priorityThreshold
           
private  ProjectStats projectStats
           
private  int verbosityLevel
           
 
Fields inherited from interface edu.umd.cs.findbugs.BugReporter
NORMAL, SILENT
 
Constructor Summary
AbstractBugReporter()
           
 
Method Summary
 void addObserver(BugReporterObserver observer)
          Add an observer.
abstract  void beginReport()
           
protected abstract  void doReportBug(BugInstance bugInstance)
          Subclasses must override this.
abstract  void endReport()
           
 FindBugs getEngine()
           
static java.lang.String getMissingClassName(java.lang.ClassNotFoundException ex)
           
 ProjectStats getProjectStats()
          Get ProjectStats object used to store statistics about the overall project being analyzed.
 void logError(java.lang.String message)
          Log an error that occurs while looking for bugs.
protected  void notifyObservers(BugInstance bugInstance)
          This should be called when a bug is reported by a subclass.
 void reportBug(BugInstance bugInstance)
          Report a bug.
abstract  void reportLine(java.lang.String msg)
           
 void reportMissingClass(java.lang.ClassNotFoundException ex)
          Called to report a lookup failure.
 void reportQueuedErrors()
          Report any accumulated error messages.
 void setEngine(FindBugs engine)
          Called to give the BugReporter a reference to the FindBugs engine object.
 void setErrorVerbosity(int level)
          Set the error-reporting verbosity level.
 void setPriorityThreshold(int threshold)
          Set the priority threshold.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.umd.cs.findbugs.BugReporter
finish
 
Methods inherited from interface edu.umd.cs.findbugs.ba.ClassObserver
observeClass
 

Field Detail

engine

private FindBugs engine

verbosityLevel

private int verbosityLevel

priorityThreshold

private int priorityThreshold

missingClassMessageSet

private java.util.HashSet<java.lang.String> missingClassMessageSet

missingClassMessageList

private java.util.LinkedList<java.lang.String> missingClassMessageList

errorMessageList

private java.util.LinkedList<java.lang.String> errorMessageList

observerList

private java.util.List<BugReporterObserver> observerList

projectStats

private ProjectStats projectStats
Constructor Detail

AbstractBugReporter

public AbstractBugReporter()
Method Detail

setEngine

public void setEngine(FindBugs engine)
Description copied from interface: BugReporter
Called to give the BugReporter a reference to the FindBugs engine object.

Specified by:
setEngine in interface BugReporter
Parameters:
engine - the FindBugs engine object

getEngine

public FindBugs getEngine()

setErrorVerbosity

public void setErrorVerbosity(int level)
Description copied from interface: BugReporter
Set the error-reporting verbosity level.

Specified by:
setErrorVerbosity in interface BugReporter
Parameters:
level - the verbosity level

setPriorityThreshold

public void setPriorityThreshold(int threshold)
Description copied from interface: BugReporter
Set the priority threshold.

Specified by:
setPriorityThreshold in interface BugReporter
Parameters:
threshold - bug instances must be at least as important as this priority to be reported

reportBug

public final void reportBug(BugInstance bugInstance)
Description copied from interface: BugReporter
Report a bug. The implementation may report the bug immediately, or queue it for later.

Specified by:
reportBug in interface BugReporter
Parameters:
bugInstance - object describing the bug instance

getMissingClassName

public static java.lang.String getMissingClassName(java.lang.ClassNotFoundException ex)

reportMissingClass

public void reportMissingClass(java.lang.ClassNotFoundException ex)
Description copied from interface: RepositoryLookupFailureCallback
Called to report a lookup failure.

Specified by:
reportMissingClass in interface RepositoryLookupFailureCallback
Parameters:
ex - a ClassNotFoundException resulting from the failure

logError

public void logError(java.lang.String message)
Description copied from interface: BugReporter
Log an error that occurs while looking for bugs.

Specified by:
logError in interface BugReporter
Parameters:
message - the error message

reportQueuedErrors

public void reportQueuedErrors()
Description copied from interface: BugReporter
Report any accumulated error messages.

Specified by:
reportQueuedErrors in interface BugReporter

addObserver

public void addObserver(BugReporterObserver observer)
Description copied from interface: BugReporter
Add an observer.

Specified by:
addObserver in interface BugReporter
Parameters:
observer - the observer

getProjectStats

public ProjectStats getProjectStats()
Description copied from interface: BugReporter
Get ProjectStats object used to store statistics about the overall project being analyzed.

Specified by:
getProjectStats in interface BugReporter

notifyObservers

protected void notifyObservers(BugInstance bugInstance)
This should be called when a bug is reported by a subclass.


doReportBug

protected abstract void doReportBug(BugInstance bugInstance)
Subclasses must override this. It will be called only for bugs which meet the priority threshold.


beginReport

public abstract void beginReport()

reportLine

public abstract void reportLine(java.lang.String msg)

endReport

public abstract void endReport()