Package edu.umd.cs.findbugs
Interface BugCollection
-
- All Superinterfaces:
java.lang.Iterable<BugInstance>
- All Known Implementing Classes:
SortedBugCollection
public interface BugCollection extends java.lang.Iterable<BugInstance>
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringANALYSIS_ERROR_ELEMENT_NAMEstatic java.lang.StringAPP_CLASS_ELEMENT_NAMEstatic java.lang.StringCLASS_HASHES_ELEMENT_NAMEstatic java.lang.StringERROR_ELEMENT_NAMEstatic java.lang.StringERROR_EXCEPTION_ELEMENT_NAMEstatic java.lang.StringERROR_MESSAGE_ELEMENT_NAMEstatic java.lang.StringERROR_STACK_TRACE_ELEMENT_NAMEstatic java.lang.StringERRORS_ELEMENT_NAMEstatic java.lang.StringHISTORY_ELEMENT_NAMEstatic java.lang.StringMISSING_CLASS_ELEMENT_NAMEstatic java.lang.StringPROJECT_ELEMENT_NAMEstatic java.lang.StringROOT_ELEMENT_NAMEstatic java.lang.StringSRCMAP_ELEMENT_NAMEstatic java.lang.StringSUMMARY_HTML_ELEMENT_NAME
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description 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(AnalysisError error)Add an analysis error.voidaddError(java.lang.String message)Add an analysis error.voidaddMissingClass(java.lang.String message)Add a missing class message.java.util.Iterator<AppVersion>appVersionIterator()Get an Iterator over AppVersions defined in the collection.voidbugsPopulated()voidclearAppVersions()Clear all AppVersions representing previously-analyzed versions of the application.voidclearClassFeatures()voidclearMissingClasses()BugCollectioncreateEmptyCollectionWithMetadata()Create a new empty BugCollection with the same metadata as this one.BugInstancefindBug(java.lang.String instanceHash, java.lang.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.CloudgetCloud()Get the instance of user annotation pluginCloudgetCloudLazily()java.util.Collection<BugInstance>getCollection()Return the Collection storing the BugInstance objects.AppVersiongetCurrentAppVersion()Get the current AppVersion.ProjectgetProject()ProjectStatsgetProjectStats()Get the project stats.java.lang.StringgetReleaseName()Get the current release name.longgetSequenceNumber()Get the sequence number of the BugCollection.longgetTimestamp()Get the timestamp for the analyzed code (when it was compiled)booleangetWithMessages()Return whether textual messages will be added to any generated XMLjava.util.Map<java.lang.String,java.lang.String>getXmlCloudDetails()booleanhasDeadBugs()booleanisApplySuppressions()booleanisMultiversion()java.util.Iterator<BugInstance>iterator()Return an Iterator over all the BugInstance objects in the BugCollection.BugInstancelookupFromUniqueId(java.lang.String uniqueId)Deprecated.voidreadXML(java.io.InputStream in)Read XML data from given input stream into this object, populating the Project as a side effect.voidreadXML(java.io.Reader reader)Read XML data from given reader into this object, populating the Project as a side effect.voidreadXML(java.lang.String fileName)Read XML data from given file into this object, populating given Project as a side effect.CloudreinitializeCloud()voidsetAnalysisTimestamp(long timestamp)Set the timestamp for when the analysis was performed.voidsetAnalysisVersion(java.lang.String analysisVersion)Set the version of FindBugs used to perform the analysisvoidsetApplySuppressions(boolean applySuppressions)voidsetClassFeatureSet(ClassFeatureSet classFeatureSet)voidsetMinimalXML(boolean minimalXML)Set whether we should minimize XMLvoidsetReleaseName(java.lang.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 (when it was compiled)voidsetWithMessages(boolean withMessages)Set whether textual messages should be added to any generated XMLvoidsetXmlCloudDetails(java.util.Map<java.lang.String,java.lang.String> map)org.dom4j.DocumenttoDocument()Convert the BugCollection into a dom4j Document object.voidwriteEpilogue(XMLOutput xmlOutput)voidwritePrologue(XMLOutput xmlOutput)voidwriteXML(XMLOutput xmlOutput)Write the BugCollection to an XMLOutput object.voidwriteXML(java.io.OutputStream out)Write the BugCollection to given output stream as XML using a UTF8 encoding.voidwriteXML(java.io.Writer out)Write the BugCollection to given output stream as XML.voidwriteXML(java.lang.String fileName)Write this BugCollection to a file as XML.
-
-
-
Field Detail
-
ROOT_ELEMENT_NAME
static final java.lang.String ROOT_ELEMENT_NAME
- See Also:
- Constant Field Values
-
SRCMAP_ELEMENT_NAME
static final java.lang.String SRCMAP_ELEMENT_NAME
- See Also:
- Constant Field Values
-
PROJECT_ELEMENT_NAME
static final java.lang.String PROJECT_ELEMENT_NAME
- See Also:
- Constant Field Values
-
ERRORS_ELEMENT_NAME
static final java.lang.String ERRORS_ELEMENT_NAME
- See Also:
- Constant Field Values
-
ANALYSIS_ERROR_ELEMENT_NAME
static final java.lang.String ANALYSIS_ERROR_ELEMENT_NAME
- See Also:
- Constant Field Values
-
ERROR_ELEMENT_NAME
static final java.lang.String ERROR_ELEMENT_NAME
- See Also:
- Constant Field Values
-
ERROR_MESSAGE_ELEMENT_NAME
static final java.lang.String ERROR_MESSAGE_ELEMENT_NAME
- See Also:
- Constant Field Values
-
ERROR_EXCEPTION_ELEMENT_NAME
static final java.lang.String ERROR_EXCEPTION_ELEMENT_NAME
- See Also:
- Constant Field Values
-
ERROR_STACK_TRACE_ELEMENT_NAME
static final java.lang.String ERROR_STACK_TRACE_ELEMENT_NAME
- See Also:
- Constant Field Values
-
MISSING_CLASS_ELEMENT_NAME
static final java.lang.String MISSING_CLASS_ELEMENT_NAME
- See Also:
- Constant Field Values
-
SUMMARY_HTML_ELEMENT_NAME
static final java.lang.String SUMMARY_HTML_ELEMENT_NAME
- See Also:
- Constant Field Values
-
APP_CLASS_ELEMENT_NAME
static final java.lang.String APP_CLASS_ELEMENT_NAME
- See Also:
- Constant Field Values
-
CLASS_HASHES_ELEMENT_NAME
static final java.lang.String CLASS_HASHES_ELEMENT_NAME
- See Also:
- Constant Field Values
-
HISTORY_ELEMENT_NAME
static final java.lang.String HISTORY_ELEMENT_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getProject
Project getProject()
-
setReleaseName
void setReleaseName(java.lang.String releaseName)
Set the current release name.- Parameters:
releaseName- the current release name
-
getReleaseName
java.lang.String getReleaseName()
Get the current release name.- Returns:
- current release name
-
getProjectStats
ProjectStats getProjectStats()
Get the project stats.
-
setTimestamp
void setTimestamp(long timestamp)
Get the timestamp for the analyzed code (when it was compiled)- Parameters:
timestamp- the timestamp.
-
getTimestamp
long getTimestamp()
Get the timestamp for the analyzed code (when it was compiled)
-
setAnalysisTimestamp
void setAnalysisTimestamp(long timestamp)
Set the timestamp for when the analysis was performed.- Parameters:
timestamp- the analysis timestamp.
-
setAnalysisVersion
void setAnalysisVersion(java.lang.String analysisVersion)
Set the version of FindBugs used to perform the analysis- Parameters:
analysisVersion- the analysis version.
-
getAnalysisTimestamp
long getAnalysisTimestamp()
Get the timestamp for when the analysis was performed.
-
getAppVersionFromSequenceNumber
AppVersion getAppVersionFromSequenceNumber(long target)
Gets the AppVersion corresponding to the given sequence number.
-
setSequenceNumber
void setSequenceNumber(long sequence)
Set the sequence number of the BugCollection.- Parameters:
sequence- the sequence number- See Also:
getSequenceNumber()
-
getSequenceNumber
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
-
isMultiversion
boolean isMultiversion()
-
hasDeadBugs
boolean hasDeadBugs()
-
clearAppVersions
void clearAppVersions()
Clear all AppVersions representing previously-analyzed versions of the application.
-
addAppVersion
void addAppVersion(AppVersion appVersion)
Add an AppVersion representing a version of the analyzed application.- Parameters:
appVersion- the AppVersion
-
getCurrentAppVersion
AppVersion getCurrentAppVersion()
Get the current AppVersion.
-
appVersionIterator
java.util.Iterator<AppVersion> appVersionIterator()
Get an Iterator over AppVersions defined in the collection.
-
add
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
boolean add(BugInstance bugInstance, boolean updateActiveTime)
Add a BugInstance to this BugCollection.- Parameters:
bugInstance- the BugInstanceupdateActiveTime- 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
-
lookupFromUniqueId
@Deprecated BugInstance lookupFromUniqueId(java.lang.String uniqueId)
Deprecated.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.
-
addError
void addError(java.lang.String message)
Add an analysis error.- Parameters:
message- the error message
-
addError
void addError(AnalysisError error)
Add an analysis error.- Parameters:
error- the AnalysisError object to add
-
addMissingClass
void addMissingClass(java.lang.String message)
Add a missing class message.- Parameters:
message- the missing class message
-
setClassFeatureSet
void setClassFeatureSet(ClassFeatureSet classFeatureSet)
-
writePrologue
void writePrologue(XMLOutput xmlOutput) throws java.io.IOException
- Throws:
java.io.IOException
-
writeEpilogue
void writeEpilogue(XMLOutput xmlOutput) throws java.io.IOException
- Throws:
java.io.IOException
-
clearClassFeatures
void clearClassFeatures()
-
clearMissingClasses
void clearMissingClasses()
-
readXML
void readXML(java.lang.String fileName) throws java.io.IOException, org.dom4j.DocumentExceptionRead XML data from given file into this object, populating given Project as a side effect.- Parameters:
fileName- name of the file to read- Throws:
java.io.IOExceptionorg.dom4j.DocumentException
-
readXML
void readXML(@WillClose java.io.InputStream in) throws java.io.IOException, org.dom4j.DocumentExceptionRead 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- Throws:
java.io.IOExceptionorg.dom4j.DocumentException
-
readXML
void readXML(@WillClose java.io.Reader reader) throws java.io.IOException, org.dom4j.DocumentExceptionRead XML data from given reader into this object, populating the Project as a side effect. An attempt will be made to close the reader (even if an exception is thrown).- Parameters:
reader- the Reader- Throws:
java.io.IOExceptionorg.dom4j.DocumentException
-
writeXML
void writeXML(java.lang.String fileName) throws java.io.IOExceptionWrite this BugCollection to a file as XML.- Parameters:
fileName- the file to write to- Throws:
java.io.IOException
-
writeXML
void writeXML(@WillClose java.io.Writer out) throws java.io.IOExceptionWrite 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- Throws:
java.io.IOException
-
writeXML
void writeXML(@WillClose java.io.OutputStream out) throws java.io.IOExceptionWrite the BugCollection to given output stream as XML using a UTF8 encoding. The output stream will be closed, even if an exception is thrown.- Parameters:
out- the OutputStream to write to- Throws:
java.io.IOException
-
writeXML
void writeXML(@WillClose XMLOutput xmlOutput) throws java.io.IOExceptionWrite 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- Throws:
java.io.IOException
-
iterator
java.util.Iterator<BugInstance> iterator()
Return an Iterator over all the BugInstance objects in the BugCollection.- Specified by:
iteratorin interfacejava.lang.Iterable<BugInstance>
-
getCollection
java.util.Collection<BugInstance> getCollection()
Return the Collection storing the BugInstance objects.
-
toDocument
org.dom4j.Document toDocument()
Convert the BugCollection into a dom4j Document object.- Returns:
- the Document representing the BugCollection as a dom4j tree
-
createEmptyCollectionWithMetadata
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
-
setWithMessages
void setWithMessages(boolean withMessages)
Set whether textual messages should be added to any generated XML
-
setMinimalXML
void setMinimalXML(boolean minimalXML)
Set whether we should minimize XML
-
getWithMessages
boolean getWithMessages()
Return whether textual messages will be added to any generated XML
-
findBug
BugInstance findBug(java.lang.String instanceHash, java.lang.String bugType, int lineNumber)
-
isApplySuppressions
boolean isApplySuppressions()
-
setApplySuppressions
void setApplySuppressions(boolean applySuppressions)
-
getCloud
@Nonnull Cloud getCloud()
Get the instance of user annotation plugin- Returns:
- user annotation plugin
-
getCloudLazily
@CheckForNull Cloud getCloudLazily()
-
reinitializeCloud
@Nonnull Cloud reinitializeCloud()
-
setXmlCloudDetails
void setXmlCloudDetails(java.util.Map<java.lang.String,java.lang.String> map)
-
getXmlCloudDetails
java.util.Map<java.lang.String,java.lang.String> getXmlCloudDetails()
-
bugsPopulated
void bugsPopulated()
-
-