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, ResourceBundle bundle, org.apache.maven.plugin.logging.Log log, ThresholdParameter threshold, boolean isJXRReportEnabled, EffortParameter effort)
          Default constructor.
 
Method Summary
protected  String assembleJXRHyperlink(edu.umd.cs.findbugs.SourceLineAnnotation line, 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()
           
 ResourceBundle getBundle()
           
static String getCOLUMN_BUG_KEY()
           
static String getCOLUMN_BUGS_KEY()
           
static String getCOLUMN_CATEGORY_KEY()
           
static String getCOLUMN_CLASS_KEY()
           
static String getCOLUMN_CLASSES_KEY()
           
static String getCOLUMN_DETAILS_KEY()
           
static String getCOLUMN_ERRORS_KEY()
           
static String getCOLUMN_FILES_KEY()
           
static String getCOLUMN_LINE_KEY()
           
static String getCOLUMN_MISSINGCLASSES_KEY()
           
 String getCurrentClassName()
           
static String getDETAILSLINK_KEY()
           
static String getEFFORT_KEY()
           
 EffortParameter getEffort()
           
 int getErrorCount()
           
 int getFileCount()
           
static String getFILES_KEY()
           
 boolean getIsJXRReportEnabled()
           
static String getJXR_PATHPREFIX_KEY()
           
static String getLINK_KEY()
           
static String getLINKTITLE_KEY()
           
 org.apache.maven.plugin.logging.Log getMavenLog()
           
 groovy.lang.MetaClass getMetaClass()
           
 boolean getMIsCurrentClassReportOpened()
           
 int getMissingClassCount()
           
 Set getMissingClassSet()
           
static String getNAME_KEY()
           
static String getNOLINE_KEY()
           
 Object getProperty(String name)
           
 edu.umd.cs.findbugs.BugReporter getRealBugReporter()
          Get the real bug reporter at the end of a chain of delegating bug reporters.
static String getREPORT_TITLE_KEY()
           
protected  String getReportTitle()
          Gets the report title.
 org.apache.maven.doxia.sink.Sink getSink()
           
static String getSUMMARY_KEY()
           
static String getTHRESHOLD_KEY()
           
 ThresholdParameter getThreshold()
           
static String getURL_SEPARATOR()
           
static String getVERSIONTITLE_KEY()
           
 Object invokeMethod(String name, Object args)
           
 boolean isIsJXRReportEnabled()
           
 boolean isMIsCurrentClassReportOpened()
           
 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.
 void setBugCollection(edu.umd.cs.findbugs.SortedBugCollection value)
           
 void setBugCount(int value)
           
 void setBundle(ResourceBundle value)
           
 void setCurrentClassName(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(Set value)
           
 void setProperty(String name, Object value)
           
 void setSink(org.apache.maven.doxia.sink.Sink value)
           
 void setThreshold(ThresholdParameter value)
           
protected  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,
                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 String getNOLINE_KEY()

getCOLUMN_LINE_KEY

public static final String getCOLUMN_LINE_KEY()

getCOLUMN_BUG_KEY

public static final String getCOLUMN_BUG_KEY()

getCOLUMN_BUGS_KEY

public static final String getCOLUMN_BUGS_KEY()

getCOLUMN_CATEGORY_KEY

public static final String getCOLUMN_CATEGORY_KEY()

getCOLUMN_DETAILS_KEY

public static final String getCOLUMN_DETAILS_KEY()

getREPORT_TITLE_KEY

public static final String getREPORT_TITLE_KEY()

getLINKTITLE_KEY

public static final String getLINKTITLE_KEY()

getLINK_KEY

public static final String getLINK_KEY()

getNAME_KEY

public static final String getNAME_KEY()

getFILES_KEY

public static final String getFILES_KEY()

getTHRESHOLD_KEY

public static final String getTHRESHOLD_KEY()

getURL_SEPARATOR

public static final String getURL_SEPARATOR()

getJXR_PATHPREFIX_KEY

public static final String getJXR_PATHPREFIX_KEY()

getEFFORT_KEY

public static final String getEFFORT_KEY()

getDETAILSLINK_KEY

public static final String getDETAILSLINK_KEY()

getVERSIONTITLE_KEY

public static final String getVERSIONTITLE_KEY()

getSUMMARY_KEY

public static final String getSUMMARY_KEY()

getCOLUMN_CLASS_KEY

public static final String getCOLUMN_CLASS_KEY()

getCOLUMN_CLASSES_KEY

public static final String getCOLUMN_CLASSES_KEY()

getCOLUMN_ERRORS_KEY

public static final String getCOLUMN_ERRORS_KEY()

getCOLUMN_FILES_KEY

public static final String getCOLUMN_FILES_KEY()

getCOLUMN_MISSINGCLASSES_KEY

public static final 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 ResourceBundle getBundle()

setBundle

public void setBundle(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 String getCurrentClassName()

setCurrentClassName

public void setCurrentClassName(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 Set getMissingClassSet()

setMissingClassSet

public void setMissingClassSet(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(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 line,
                                      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 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 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 Object invokeMethod(String name,
                           Object args)

getProperty

public Object getProperty(String name)

setProperty

public void setProperty(String name,
                        Object value)


Copyright © 2005-2011 Codehaus. All Rights Reserved.