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 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.groovy 6588 2008-03-28 12:22:57Z bentmann $
Author:
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 sink, java.util.ResourceBundle bundle, org.apache.maven.plugin.logging.Log log, ThresholdParameter threshold, boolean isJXRReportEnabled, EffortParameter effort)
          Default constructor.
 
Method Summary
protected  java.lang.String assembleJXRHyperlink(edu.umd.cs.findbugs.SourceLineAnnotation line, java.lang.String lineNumber)
          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()
           
 edu.umd.cs.findbugs.SortedBugCollection getBugCollection()
           
 int getBugCount()
           
 java.util.ResourceBundle getBundle()
           
static java.lang.String getCOLUMN_BUG_KEY()
           
static java.lang.String getCOLUMN_BUGS_KEY()
           
static java.lang.String getCOLUMN_CATEGORY_KEY()
           
static java.lang.String getCOLUMN_CLASS_KEY()
           
static java.lang.String getCOLUMN_CLASSES_KEY()
           
static java.lang.String getCOLUMN_DETAILS_KEY()
           
static java.lang.String getCOLUMN_ERRORS_KEY()
           
static java.lang.String getCOLUMN_FILES_KEY()
           
static java.lang.String getCOLUMN_LINE_KEY()
           
static java.lang.String getCOLUMN_MISSINGCLASSES_KEY()
           
 java.lang.String getCurrentClassName()
           
static java.lang.String getDETAILSLINK_KEY()
           
static java.lang.String getEFFORT_KEY()
           
 EffortParameter getEffort()
           
 int getErrorCount()
           
 int getFileCount()
           
static java.lang.String getFILES_KEY()
           
 boolean getIsJXRReportEnabled()
           
static java.lang.String getJXR_PATHPREFIX_KEY()
           
static java.lang.String getLINK_KEY()
           
static java.lang.String getLINKTITLE_KEY()
           
 org.apache.maven.plugin.logging.Log getMavenLog()
           
 groovy.lang.MetaClass getMetaClass()
           
 boolean getMIsCurrentClassReportOpened()
           
 int getMissingClassCount()
           
 java.util.Set getMissingClassSet()
           
static java.lang.String getNAME_KEY()
           
static java.lang.String getNOLINE_KEY()
           
 java.lang.Object getProperty(java.lang.String name)
           
 edu.umd.cs.findbugs.BugReporter getRealBugReporter()
          Get the real bug reporter at the end of a chain of delegating bug reporters.
static java.lang.String getREPORT_TITLE_KEY()
           
protected  java.lang.String getReportTitle()
          Gets the report title.
 org.apache.maven.doxia.sink.Sink getSink()
           
static java.lang.String getSUMMARY_KEY()
           
static java.lang.String getTHRESHOLD_KEY()
           
 ThresholdParameter getThreshold()
           
static java.lang.String getURL_SEPARATOR()
           
static java.lang.String getVERSIONTITLE_KEY()
           
 java.lang.Object invokeMethod(java.lang.String name, java.lang.Object args)
           
 boolean isIsJXRReportEnabled()
           
 boolean isMIsCurrentClassReportOpened()
           
 void logError(java.lang.String message)
           
 void logError(java.lang.String message, java.lang.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(java.lang.ClassNotFoundException ex)
           
 void reportMissingClass(java.lang.String missingClass)
          Report a missing class.
 void setBugCollection(edu.umd.cs.findbugs.SortedBugCollection value)
           
 void setBugCount(int value)
           
 void setBundle(java.util.ResourceBundle value)
           
 void setCurrentClassName(java.lang.String value)
           
 void setEffort(EffortParameter value)
           
 void setErrorCount(int value)
           
 void setFileCount(int value)
           
 void setIsJXRReportEnabled(boolean value)
           
 void setMavenLog(org.apache.maven.plugin.logging.Log value)
           
 void setMetaClass(groovy.lang.MetaClass metaClass)
           
 void setMIsCurrentClassReportOpened(boolean value)
           
 void setMissingClassCount(int value)
           
 void setMissingClassSet(java.util.Set value)
           
 void setProperty(java.lang.String name, java.lang.Object value)
           
 void setSink(org.apache.maven.doxia.sink.Sink value)
           
 void setThreshold(ThresholdParameter value)
           
protected  java.lang.String valueForLine(edu.umd.cs.findbugs.SourceLineAnnotation line)
          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, reportBugsFromXml, 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 sink,
                java.util.ResourceBundle bundle,
                org.apache.maven.plugin.logging.Log log,
                ThresholdParameter threshold,
                boolean isJXRReportEnabled,
                EffortParameter effort)
Default constructor.

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

getNOLINE_KEY

public static final java.lang.String getNOLINE_KEY()

getCOLUMN_LINE_KEY

public static final java.lang.String getCOLUMN_LINE_KEY()

getCOLUMN_BUG_KEY

public static final java.lang.String getCOLUMN_BUG_KEY()

getCOLUMN_BUGS_KEY

public static final java.lang.String getCOLUMN_BUGS_KEY()

getCOLUMN_CATEGORY_KEY

public static final java.lang.String getCOLUMN_CATEGORY_KEY()

getCOLUMN_DETAILS_KEY

public static final java.lang.String getCOLUMN_DETAILS_KEY()

getREPORT_TITLE_KEY

public static final java.lang.String getREPORT_TITLE_KEY()

getLINKTITLE_KEY

public static final java.lang.String getLINKTITLE_KEY()

getLINK_KEY

public static final java.lang.String getLINK_KEY()

getNAME_KEY

public static final java.lang.String getNAME_KEY()

getFILES_KEY

public static final java.lang.String getFILES_KEY()

getTHRESHOLD_KEY

public static final java.lang.String getTHRESHOLD_KEY()

getURL_SEPARATOR

public static final java.lang.String getURL_SEPARATOR()

getJXR_PATHPREFIX_KEY

public static final java.lang.String getJXR_PATHPREFIX_KEY()

getEFFORT_KEY

public static final java.lang.String getEFFORT_KEY()

getDETAILSLINK_KEY

public static final java.lang.String getDETAILSLINK_KEY()

getVERSIONTITLE_KEY

public static final java.lang.String getVERSIONTITLE_KEY()

getSUMMARY_KEY

public static final java.lang.String getSUMMARY_KEY()

getCOLUMN_CLASS_KEY

public static final java.lang.String getCOLUMN_CLASS_KEY()

getCOLUMN_CLASSES_KEY

public static final java.lang.String getCOLUMN_CLASSES_KEY()

getCOLUMN_ERRORS_KEY

public static final java.lang.String getCOLUMN_ERRORS_KEY()

getCOLUMN_FILES_KEY

public static final java.lang.String getCOLUMN_FILES_KEY()

getCOLUMN_MISSINGCLASSES_KEY

public static final java.lang.String getCOLUMN_MISSINGCLASSES_KEY()

getSink

public org.apache.maven.doxia.sink.Sink getSink()

setSink

public void setSink(org.apache.maven.doxia.sink.Sink value)

getBundle

public java.util.ResourceBundle getBundle()

setBundle

public void setBundle(java.util.ResourceBundle value)

getMavenLog

public org.apache.maven.plugin.logging.Log getMavenLog()

setMavenLog

public void setMavenLog(org.apache.maven.plugin.logging.Log value)

getThreshold

public ThresholdParameter getThreshold()

setThreshold

public void setThreshold(ThresholdParameter value)

getEffort

public EffortParameter getEffort()

setEffort

public void setEffort(EffortParameter value)

getCurrentClassName

public java.lang.String getCurrentClassName()

setCurrentClassName

public void setCurrentClassName(java.lang.String value)

getMIsCurrentClassReportOpened

public boolean getMIsCurrentClassReportOpened()

isMIsCurrentClassReportOpened

public boolean isMIsCurrentClassReportOpened()

setMIsCurrentClassReportOpened

public void setMIsCurrentClassReportOpened(boolean value)

getIsJXRReportEnabled

public boolean getIsJXRReportEnabled()

isIsJXRReportEnabled

public boolean isIsJXRReportEnabled()

setIsJXRReportEnabled

public void setIsJXRReportEnabled(boolean value)

getBugCollection

public edu.umd.cs.findbugs.SortedBugCollection getBugCollection()

setBugCollection

public void setBugCollection(edu.umd.cs.findbugs.SortedBugCollection value)

getBugCount

public int getBugCount()

setBugCount

public void setBugCount(int value)

getMissingClassCount

public int getMissingClassCount()

setMissingClassCount

public void setMissingClassCount(int value)

getFileCount

public int getFileCount()

setFileCount

public void setFileCount(int value)

getMissingClassSet

public java.util.Set getMissingClassSet()

setMissingClassSet

public void setMissingClassSet(java.util.Set value)

getErrorCount

public int getErrorCount()

setErrorCount

public void setErrorCount(int value)

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(java.lang.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(java.lang.String message,
                     java.lang.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(java.lang.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(java.lang.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 java.lang.String assembleJXRHyperlink(edu.umd.cs.findbugs.SourceLineAnnotation line,
                                                java.lang.String lineNumber)
Assembles the hyperlink to point to the source code.

Parameters:
line - The line number object with the bug.
lineNumber - 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)

getReportTitle

protected java.lang.String getReportTitle()
Gets the report title.

Returns:
The report title.

openClassReportSection

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


valueForLine

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

Parameters:
line - 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)

getMetaClass

public groovy.lang.MetaClass getMetaClass()

setMetaClass

public void setMetaClass(groovy.lang.MetaClass metaClass)

invokeMethod

public java.lang.Object invokeMethod(java.lang.String name,
                                     java.lang.Object args)

getProperty

public java.lang.Object getProperty(java.lang.String name)

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)


Copyright © 2005-2009. All Rights Reserved.