Package edu.umd.cs.findbugs
Class BugReportDispatcher
- java.lang.Object
-
- edu.umd.cs.findbugs.BugReportDispatcher
-
- All Implemented Interfaces:
RepositoryLookupFailureCallback
,BugReporter
,IClassObserver
,IErrorLogger
,ConfigurableBugReporter
public class BugReportDispatcher extends java.lang.Object implements ConfigurableBugReporter
Bug reporter delegate actual operation to each bug reporter in the list. It is designed to output multiple reports in batch.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<TextUIBugReporter>
reporters
-
Fields inherited from interface edu.umd.cs.findbugs.BugReporter
NORMAL, SILENT
-
-
Constructor Summary
Constructors Constructor Description BugReportDispatcher(java.util.Collection<TextUIBugReporter> reporters)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addObserver(BugReporterObserver observer)
Add an observer.void
finish()
Finish reporting bugs.private void
forEach(java.util.function.Consumer<TextUIBugReporter> consumer)
Consume each reporter one by one, and throw an exception if some of them.BugCollection
getBugCollection()
Get the bug collection (if any) associated with this bug reporterProjectStats
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 performing analysis.void
logError(java.lang.String message, java.lang.Throwable e)
Log an error that occurs while performing analysis.void
observeClass(ClassDescriptor classDescriptor)
Observe a class being visited.void
reportBug(BugInstance bugInstance)
Report a bug.void
reportMissingClass(ClassDescriptor classDescriptor)
Called to report a class lookup failure.void
reportMissingClass(java.lang.ClassNotFoundException ex)
Called to report a class lookup failure.void
reportQueuedErrors()
Report any accumulated error messages.void
reportSkippedAnalysis(MethodDescriptor method)
Report that we skipped some analysis of a methodvoid
setErrorVerbosity(int level)
Set the error-reporting verbosity level.void
setOutputStream(java.io.PrintStream outputStream)
void
setPriorityThreshold(int threshold)
Set the priority threshold.void
setRankThreshold(int threshold)
void
setUseLongBugCodes(boolean useLongBugCodes)
-
-
-
Field Detail
-
reporters
@NonNull private final java.util.List<TextUIBugReporter> reporters
-
-
Constructor Detail
-
BugReportDispatcher
public BugReportDispatcher(java.util.Collection<TextUIBugReporter> reporters)
-
-
Method Detail
-
setErrorVerbosity
public void setErrorVerbosity(int level)
Description copied from interface:BugReporter
Set the error-reporting verbosity level.- Specified by:
setErrorVerbosity
in interfaceBugReporter
- Parameters:
level
- the verbosity level
-
setPriorityThreshold
public void setPriorityThreshold(int threshold)
Description copied from interface:BugReporter
Set the priority threshold.- Specified by:
setPriorityThreshold
in interfaceBugReporter
- Parameters:
threshold
- bug instances must be at least as important as this priority to be reported
-
finish
public void finish()
Description copied from interface:BugReporter
Finish reporting bugs. If any bug reports have been queued, calling this method will flush them.- Specified by:
finish
in interfaceBugReporter
-
reportQueuedErrors
public void reportQueuedErrors()
Description copied from interface:BugReporter
Report any accumulated error messages.- Specified by:
reportQueuedErrors
in interfaceBugReporter
-
addObserver
public void addObserver(BugReporterObserver observer)
Description copied from interface:BugReporter
Add an observer.- Specified by:
addObserver
in interfaceBugReporter
- 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 interfaceBugReporter
-
reportBug
public void reportBug(@NonNull 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 interfaceBugReporter
- Parameters:
bugInstance
- object describing the bug instance
-
getBugCollection
@CheckForNull public BugCollection getBugCollection()
Description copied from interface:BugReporter
Get the bug collection (if any) associated with this bug reporter- Specified by:
getBugCollection
in interfaceBugReporter
-
observeClass
public void observeClass(ClassDescriptor classDescriptor)
Description copied from interface:IClassObserver
Observe a class being visited.- Specified by:
observeClass
in interfaceIClassObserver
- Parameters:
classDescriptor
- class being visited
-
reportMissingClass
public void reportMissingClass(java.lang.ClassNotFoundException ex)
Description copied from interface:IErrorLogger
Called to report a class lookup failure.- Specified by:
reportMissingClass
in interfaceIErrorLogger
- Parameters:
ex
- a ClassNotFoundException resulting from the class lookup failure
-
reportMissingClass
public void reportMissingClass(ClassDescriptor classDescriptor)
Description copied from interface:IErrorLogger
Called to report a class lookup failure.- Specified by:
reportMissingClass
in interfaceIErrorLogger
- Parameters:
classDescriptor
- ClassDescriptor of a missing class
-
logError
public void logError(java.lang.String message)
Description copied from interface:IErrorLogger
Log an error that occurs while performing analysis.- Specified by:
logError
in interfaceIErrorLogger
- Parameters:
message
- the error message
-
logError
public void logError(java.lang.String message, java.lang.Throwable e)
Description copied from interface:IErrorLogger
Log an error that occurs while performing analysis.- Specified by:
logError
in interfaceIErrorLogger
- Parameters:
message
- the error messagee
- the exception which is the underlying cause of the error
-
reportSkippedAnalysis
public void reportSkippedAnalysis(MethodDescriptor method)
Description copied from interface:IErrorLogger
Report that we skipped some analysis of a method- Specified by:
reportSkippedAnalysis
in interfaceIErrorLogger
- Parameters:
method
- the method we skipped
-
setRankThreshold
public void setRankThreshold(int threshold)
- Specified by:
setRankThreshold
in interfaceConfigurableBugReporter
-
setUseLongBugCodes
public void setUseLongBugCodes(boolean useLongBugCodes)
- Specified by:
setUseLongBugCodes
in interfaceConfigurableBugReporter
-
setOutputStream
public void setOutputStream(java.io.PrintStream outputStream)
- Specified by:
setOutputStream
in interfaceConfigurableBugReporter
-
forEach
private void forEach(java.util.function.Consumer<TextUIBugReporter> consumer)
Consume each reporter one by one, and throw an exception if some of them.- Parameters:
consumer
- Operation to handle each reporter.
-
-