edu.umd.cs.findbugs

Interface BugCollection

public interface BugCollection

Field Summary
static StringANALYSIS_ERROR_ELEMENT_NAME
static StringAPP_CLASS_ELEMENT_NAME
static StringCLASS_HASHES_ELEMENT_NAME
static StringERRORS_ELEMENT_NAME
static StringERROR_ELEMENT_NAME
static StringERROR_EXCEPTION_ELEMENT_NAME
static StringERROR_MESSAGE_ELEMENT_NAME
static StringERROR_STACK_TRACE_ELEMENT_NAME
static StringHISTORY_ELEMENT_NAME
static StringMISSING_CLASS_ELEMENT_NAME
static StringPROJECT_ELEMENT_NAME
static StringROOT_ELEMENT_NAME
static StringSRCMAP_ELEMENT_NAME
static StringSUMMARY_HTML_ELEMENT_NAME
Method Summary
booleanadd(BugInstance bugInstance)
Add a BugInstance to this BugCollection.
booleanadd(BugInstance bugInstance, boolean updateActiveTime)
Add a BugInstance to this BugCollection.
voidaddAppVersion(AppVersion appVersion)
Add an AppVersion representing a version of the analyzed application.
voidaddError(String message)
Add an analysis error.
voidaddError(AnalysisError error)
Add an analysis error.
voidaddMissingClass(String message)
Add a missing class message.
Iterator<AppVersion>appVersionIterator()
Get an Iterator over AppVersions defined in the collection.
abstract voidclearAppVersions()
Clear all AppVersions representing previously-analyzed versions of the application.
voidclearClassFeatures()
BugCollectioncreateEmptyCollectionWithMetadata()
Create a new empty BugCollection with the same metadata as this one.
BugInstancefindBug(String instanceHash, String bugType, int lineNumber)
longgetAnalysisTimestamp()
Get the timestamp for when the analysis was performed.
AppVersiongetAppVersionFromSequenceNumber(long target)
Gets the AppVersion corresponding to the given sequence number.
Collection<BugInstance>getCollection()
Return the Collection storing the BugInstance objects.
AppVersiongetCurrentAppVersion()
Get the current AppVersion.
ProjectStatsgetProjectStats()
Get the project stats.
StringgetReleaseName()
Get the current release name.
longgetSequenceNumber()
Get the sequence number of the BugCollection.
longgetTimestamp()
Get the timestamp for the analyzed code return the timestamp.
booleangetWithMessages()
Return whether textual messages will be added to any generated XML
Iterator<BugInstance>iterator()
Return an Iterator over all the BugInstance objects in the BugCollection.
BugInstancelookupFromUniqueId(String uniqueId)
Look up a BugInstance by its unique id.
voidreadXML(String fileName, Project project)
Read XML data from given file into this object, populating given Project as a side effect.
voidreadXML(InputStream in, Project project)
Read XML data from given input stream into this object, populating the Project as a side effect.
voidsetAnalysisTimestamp(long timestamp)
Get the timestamp for when the analysis was performed.
voidsetClassFeatureSet(ClassFeatureSet classFeatureSet)
voidsetReleaseName(String releaseName)
Set the current release name.
voidsetSequenceNumber(long sequence)
Set the sequence number of the BugCollection.
voidsetTimestamp(long timestamp)
Get the timestamp for the analyzed code
voidsetWithMessages(boolean withMessages)
Set whether textual messages should be added to any generated XML
DocumenttoDocument(Project project)
Convert the BugCollection into a dom4j Document object.
voidwriteEpilogue(XMLOutput xmlOutput)
voidwritePrologue(XMLOutput xmlOutput, Project project)
voidwriteXML(String fileName, Project project)
Write this BugCollection to a file as XML.
voidwriteXML(OutputStream out, Project project)
Write the BugCollection to given output stream as XML.
voidwriteXML(XMLOutput xmlOutput, Project project)
Write the BugCollection to an XMLOutput object.

Field Detail

ANALYSIS_ERROR_ELEMENT_NAME

public static final String ANALYSIS_ERROR_ELEMENT_NAME

APP_CLASS_ELEMENT_NAME

public static final String APP_CLASS_ELEMENT_NAME

CLASS_HASHES_ELEMENT_NAME

public static final String CLASS_HASHES_ELEMENT_NAME

ERRORS_ELEMENT_NAME

public static final String ERRORS_ELEMENT_NAME

ERROR_ELEMENT_NAME

public static final String ERROR_ELEMENT_NAME

ERROR_EXCEPTION_ELEMENT_NAME

public static final String ERROR_EXCEPTION_ELEMENT_NAME

ERROR_MESSAGE_ELEMENT_NAME

public static final String ERROR_MESSAGE_ELEMENT_NAME

ERROR_STACK_TRACE_ELEMENT_NAME

public static final String ERROR_STACK_TRACE_ELEMENT_NAME

HISTORY_ELEMENT_NAME

public static final String HISTORY_ELEMENT_NAME

MISSING_CLASS_ELEMENT_NAME

public static final String MISSING_CLASS_ELEMENT_NAME

PROJECT_ELEMENT_NAME

public static final String PROJECT_ELEMENT_NAME

ROOT_ELEMENT_NAME

public static final String ROOT_ELEMENT_NAME

SRCMAP_ELEMENT_NAME

public static final String SRCMAP_ELEMENT_NAME

SUMMARY_HTML_ELEMENT_NAME

public static final String SUMMARY_HTML_ELEMENT_NAME

Method Detail

add

public boolean add(BugInstance bugInstance)
Add a BugInstance to this BugCollection. This just calls add(bugInstance, true).

Parameters: bugInstance the BugInstance

Returns: true if the BugInstance was added, or false if a matching BugInstance was already in the BugCollection

add

public boolean add(BugInstance bugInstance, boolean updateActiveTime)
Add a BugInstance to this BugCollection.

Parameters: bugInstance the BugInstance updateActiveTime true if the warning's active time should be updated to include the collection's current time

Returns: true if the BugInstance was added, or false if a matching BugInstance was already in the BugCollection

addAppVersion

public void addAppVersion(AppVersion appVersion)
Add an AppVersion representing a version of the analyzed application.

Parameters: appVersion the AppVersion

addError

public void addError(String message)
Add an analysis error.

Parameters: message the error message

addError

public void addError(AnalysisError error)
Add an analysis error.

Parameters: error the AnalysisError object to add

addMissingClass

public void addMissingClass(String message)
Add a missing class message.

Parameters: message the missing class message

appVersionIterator

public Iterator<AppVersion> appVersionIterator()
Get an Iterator over AppVersions defined in the collection.

clearAppVersions

public abstract void clearAppVersions()
Clear all AppVersions representing previously-analyzed versions of the application.

clearClassFeatures

public void clearClassFeatures()

createEmptyCollectionWithMetadata

public BugCollection createEmptyCollectionWithMetadata()
Create a new empty BugCollection with the same metadata as this one.

Returns: a new empty BugCollection with the same metadata as this one

findBug

public BugInstance findBug(String instanceHash, String bugType, int lineNumber)

getAnalysisTimestamp

public long getAnalysisTimestamp()
Get the timestamp for when the analysis was performed.

getAppVersionFromSequenceNumber

public AppVersion getAppVersionFromSequenceNumber(long target)
Gets the AppVersion corresponding to the given sequence number.

getCollection

public Collection<BugInstance> getCollection()
Return the Collection storing the BugInstance objects.

getCurrentAppVersion

public AppVersion getCurrentAppVersion()
Get the current AppVersion.

getProjectStats

public ProjectStats getProjectStats()
Get the project stats.

getReleaseName

public String getReleaseName()
Get the current release name.

Returns: current release name

getSequenceNumber

public long getSequenceNumber()
Get the sequence number of the BugCollection. This value represents the number of times the user has analyzed a different version of the application and updated the historical bug collection using the UpdateBugCollection class.

Returns: the sequence number

getTimestamp

public long getTimestamp()
Get the timestamp for the analyzed code return the timestamp.

getWithMessages

public boolean getWithMessages()
Return whether textual messages will be added to any generated XML

iterator

public Iterator<BugInstance> iterator()
Return an Iterator over all the BugInstance objects in the BugCollection.

lookupFromUniqueId

public BugInstance lookupFromUniqueId(String uniqueId)
Look up a BugInstance by its unique id.

Parameters: uniqueId the BugInstance's unique id.

Returns: the BugInstance with the given unique id, or null if there is no such BugInstance This is deprecated; uniqueIDs are not persistent.

readXML

public void readXML(String fileName, Project project)
Read XML data from given file into this object, populating given Project as a side effect.

Parameters: fileName name of the file to read project the Project

readXML

public void readXML(InputStream in, Project project)
Read XML data from given input stream into this object, populating the Project as a side effect. An attempt will be made to close the input stream (even if an exception is thrown).

Parameters: in the InputStream project the Project

setAnalysisTimestamp

public void setAnalysisTimestamp(long timestamp)
Get the timestamp for when the analysis was performed.

Parameters: timestamp the analysis timestamp.

setClassFeatureSet

public void setClassFeatureSet(ClassFeatureSet classFeatureSet)

setReleaseName

public void setReleaseName(String releaseName)
Set the current release name.

Parameters: releaseName the current release name

setSequenceNumber

public void setSequenceNumber(long sequence)
Set the sequence number of the BugCollection.

Parameters: sequence the sequence number

See Also: getSequenceNumber

setTimestamp

public void setTimestamp(long timestamp)
Get the timestamp for the analyzed code

Parameters: timestamp the timestamp.

setWithMessages

public void setWithMessages(boolean withMessages)
Set whether textual messages should be added to any generated XML

toDocument

public Document toDocument(Project project)
Convert the BugCollection into a dom4j Document object.

Parameters: project the Project from which the BugCollection was generated

Returns: the Document representing the BugCollection as a dom4j tree

writeEpilogue

public void writeEpilogue(XMLOutput xmlOutput)

writePrologue

public void writePrologue(XMLOutput xmlOutput, Project project)

writeXML

public void writeXML(String fileName, Project project)
Write this BugCollection to a file as XML.

Parameters: fileName the file to write to project the Project from which the BugCollection was generated

writeXML

public void writeXML(OutputStream out, Project project)
Write the BugCollection to given output stream as XML. The output stream will be closed, even if an exception is thrown.

Parameters: out the OutputStream to write to project the Project from which the BugCollection was generated

writeXML

public void writeXML(XMLOutput xmlOutput, Project project)
Write the BugCollection to an XMLOutput object. The finish() method of the XMLOutput object is guaranteed to be called.

To write the SummaryHTML element, set property findbugs.report.SummaryHTML to "true".

Parameters: xmlOutput the XMLOutput object project the Project from which the BugCollection was generated

FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.