org.codehaus.mojo.findbugs
Class Reporter

java.lang.Object
  extended by edu.umd.cs.findbugs.AbstractBugReporter
      extended by edu.umd.cs.findbugs.TextUIBugReporter
          extended by org.codehaus.mojo.findbugs.Reporter
All Implemented Interfaces:
edu.umd.cs.findbugs.ba.RepositoryLookupFailureCallback, edu.umd.cs.findbugs.BugReporter, edu.umd.cs.findbugs.classfile.IClassObserver, edu.umd.cs.findbugs.classfile.IErrorLogger

public final class Reporter
extends edu.umd.cs.findbugs.TextUIBugReporter

The reporter controls the generation of the FindBugs report. It contains call back methods which gets called by FindBugs if a bug is found.

Version:
$Id: Reporter.java 4042 2007-05-07 04:52:38Z gleclaire $
Author:
$Author: cyrill $, Cyrill Ruettimann, Garvin LeClaire

Field Summary
 
Fields inherited from class edu.umd.cs.findbugs.TextUIBugReporter
outputStream
 
Fields inherited from interface edu.umd.cs.findbugs.BugReporter
NORMAL, SILENT
 
Constructor Summary
Reporter(org.apache.maven.doxia.sink.Sink pSink, ResourceBundle pBundle, org.apache.maven.plugin.logging.Log pLog, ThresholdParameter pThreshold, boolean isJXRReportEnabled, EffortParameter pEffort)
          Default constructor.
 
Method Summary
protected  String assembleJXRHyperlink(edu.umd.cs.findbugs.SourceLineAnnotation pLine, String pLineNumber)
          Assembles the hyperlink to point to the source code.
protected  void closeClassReportSection()
          Closes the class report section.
protected  void doReportBug(edu.umd.cs.findbugs.BugInstance bugInstance)
           
 void finish()
           
protected  String getDetailsLink(String pType)
          Gets the link to details description on findbugs site.
protected  String getEffortTitle()
          Gets the effort title of the report.
protected  String getFilesTitle()
          Gets the title for the files title.
protected  String getFindBugsLink()
          Gets the link to FindBugs.
protected  String getFindBugsName()
          Gets the name of FindBugs.
protected  String getFindBugsVersion()
          Gets the Findbugs Version of the report.
 edu.umd.cs.findbugs.BugReporter getRealBugReporter()
          Get the real bug reporter at the end of a chain of delegating bug reporters.
protected  String getReportLinkTitle()
          Gets the name of the link to FindBugs.
protected  String getReportTitle()
          Gets the report title.
protected  String getSummaryTitle()
          Gets the title for the summary section.
protected  String getThresholdTitle()
          Gets the threshold title of the report.
protected  String getVersionTitle()
          Gets the Findbugs Version title of the report.
 void logError(String message)
           
 void logError(String message, Throwable e)
           
 void observeClass(edu.umd.cs.findbugs.classfile.ClassDescriptor clazz)
          Observe a class.
protected  void openClassReportSection()
          Initialised a bug report section in the report for a particular class.
protected  void printBug(edu.umd.cs.findbugs.BugInstance bugInstance)
          Print the bug collection to a line in the table
protected  void printFilesSummary()
          Print the File Summary Section.
protected  void printFilesSummaryLine(int classBugs)
           
protected  void printSummary()
          Print the Summary Section.
 void reportAnalysisError(edu.umd.cs.findbugs.AnalysisError analysisError)
          Report a queued error.
 void reportMissingClass(edu.umd.cs.findbugs.classfile.ClassDescriptor classDescriptor)
           
 void reportMissingClass(ClassNotFoundException ex)
           
 void reportMissingClass(String missingClass)
          Report a missing class.
protected  String valueForLine(edu.umd.cs.findbugs.SourceLineAnnotation pLine)
          Return the value to display.
 
Methods inherited from class edu.umd.cs.findbugs.TextUIBugReporter
checkBugInstance, emitLine, getUseLongBugCodes, reportQueuedErrors, setOutputStream, setReportHistory, setReportStackTrace, setReportUserDesignations, setUseLongBugCodes
 
Methods inherited from class edu.umd.cs.findbugs.AbstractBugReporter
addObserver, getMissingClassName, getProjectStats, notifyObservers, reportBug, reportSkippedAnalysis, setErrorVerbosity, setPriorityThreshold
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Reporter

public Reporter(org.apache.maven.doxia.sink.Sink pSink,
                ResourceBundle pBundle,
                org.apache.maven.plugin.logging.Log pLog,
                ThresholdParameter pThreshold,
                boolean isJXRReportEnabled,
                EffortParameter pEffort)
Default constructor.

Parameters:
pSink - The sink to generate the report.
pBundle - The resource bundle to get the messages from.
pLog - The logger.
pThreshold - The threshold for the report.
isJXRReportEnabled - Is the jxr report plugin enabled.
pEffort - The used effort.
Method Detail

finish

public void finish()
See Also:
BugReporter.finish()

getRealBugReporter

public edu.umd.cs.findbugs.BugReporter getRealBugReporter()
Get the real bug reporter at the end of a chain of delegating bug reporters. All non-delegating bug reporters should simply "return this".

Specified by:
getRealBugReporter in interface edu.umd.cs.findbugs.BugReporter
Overrides:
getRealBugReporter in class edu.umd.cs.findbugs.TextUIBugReporter
Returns:
the real bug reporter at the end of the chain, or this object if there is no delegation
See Also:
BugReporter.getRealBugReporter()

observeClass

public void observeClass(edu.umd.cs.findbugs.classfile.ClassDescriptor clazz)
Observe a class.

Parameters:
clazz - the class
See Also:
#observeClass(edu.umd.cs.findbugs.classfile.ClassDescriptor)

reportAnalysisError

public void reportAnalysisError(edu.umd.cs.findbugs.AnalysisError analysisError)
Report a queued error.

Overrides:
reportAnalysisError in class edu.umd.cs.findbugs.TextUIBugReporter
Parameters:
analysisError - the queued error
See Also:
#reportAnalysisError(edu.umd.cs.findbugs.AnalysisError)

logError

public void logError(String message)
Specified by:
logError in interface edu.umd.cs.findbugs.classfile.IErrorLogger
Overrides:
logError in class edu.umd.cs.findbugs.AbstractBugReporter

logError

public void logError(String message,
                     Throwable e)
Specified by:
logError in interface edu.umd.cs.findbugs.classfile.IErrorLogger
Overrides:
logError in class edu.umd.cs.findbugs.AbstractBugReporter

reportMissingClass

public void reportMissingClass(String missingClass)
Report a missing class.

Overrides:
reportMissingClass in class edu.umd.cs.findbugs.TextUIBugReporter
Parameters:
missingClass - the name of the class
See Also:
#reportMissingClass(java.lang.String)

reportMissingClass

public void reportMissingClass(ClassNotFoundException ex)
Specified by:
reportMissingClass in interface edu.umd.cs.findbugs.classfile.IErrorLogger
Overrides:
reportMissingClass in class edu.umd.cs.findbugs.AbstractBugReporter

reportMissingClass

public void reportMissingClass(edu.umd.cs.findbugs.classfile.ClassDescriptor classDescriptor)
Specified by:
reportMissingClass in interface edu.umd.cs.findbugs.classfile.IErrorLogger
Overrides:
reportMissingClass in class edu.umd.cs.findbugs.AbstractBugReporter

printBug

protected void printBug(edu.umd.cs.findbugs.BugInstance bugInstance)
Print the bug collection to a line in the table

Overrides:
printBug in class edu.umd.cs.findbugs.TextUIBugReporter
Parameters:
bugInstance - the bug to print

assembleJXRHyperlink

protected String assembleJXRHyperlink(edu.umd.cs.findbugs.SourceLineAnnotation pLine,
                                      String pLineNumber)
Assembles the hyperlink to point to the source code.

Parameters:
pLine - The line number object with the bug.
pLineNumber - The line number to show in the hyperlink.
Returns:
The hyperlink which points to the code.

closeClassReportSection

protected void closeClassReportSection()
Closes the class report section.


doReportBug

protected void doReportBug(edu.umd.cs.findbugs.BugInstance bugInstance)
Specified by:
doReportBug in class edu.umd.cs.findbugs.AbstractBugReporter
Parameters:
bugInstance - The bug to report
See Also:
#doReportBug(edu.umd.cs.findbugs.BugInstance)

getDetailsLink

protected String getDetailsLink(String pType)
Gets the link to details description on findbugs site.

Parameters:
pType - the bug type
Returns:
The report link.

getEffortTitle

protected String getEffortTitle()
Gets the effort title of the report.

Returns:
The effort title of the report.

getFilesTitle

protected String getFilesTitle()
Gets the title for the files title.

Returns:
The name for the File Section.

getSummaryTitle

protected String getSummaryTitle()
Gets the title for the summary section.

Returns:
The name for the Summary Section.

getFindBugsLink

protected String getFindBugsLink()
Gets the link to FindBugs.

Returns:
The report link.

getFindBugsName

protected String getFindBugsName()
Gets the name of FindBugs.

Returns:
The name of FindBugs.

getFindBugsVersion

protected String getFindBugsVersion()
Gets the Findbugs Version of the report.

Returns:
The Findbugs Version used on the report.

getReportLinkTitle

protected String getReportLinkTitle()
Gets the name of the link to FindBugs.

Returns:
The report link title.

getReportTitle

protected String getReportTitle()
Gets the report title.

Returns:
The report title.

getThresholdTitle

protected String getThresholdTitle()
Gets the threshold title of the report.

Returns:
The threshold title of the report.

getVersionTitle

protected String getVersionTitle()
Gets the Findbugs Version title of the report.

Returns:
The Findbugs Version used on the report.

openClassReportSection

protected void openClassReportSection()
Initialised a bug report section in the report for a particular class.


valueForLine

protected String valueForLine(edu.umd.cs.findbugs.SourceLineAnnotation pLine)
Return the value to display. If FindBugs does not provide a line number, a default message is returned. The line number otherwise.

Parameters:
pLine - The line to get the value from.
Returns:
The line number the bug appears or a statement that there is no source line available.

printSummary

protected void printSummary()
Print the Summary Section.


printFilesSummary

protected void printFilesSummary()
Print the File Summary Section.


printFilesSummaryLine

protected void printFilesSummaryLine(int classBugs)


Copyright © 2005-2007 CodeHaus. All Rights Reserved.