Package edu.umd.cs.findbugs
Interface BugCollection
- All Superinterfaces:
Iterable<BugInstance>
- All Known Implementing Classes:
SortedBugCollection
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(BugInstance bugInstance) Add a BugInstance to this BugCollection.boolean
add
(BugInstance bugInstance, boolean updateActiveTime) Add a BugInstance to this BugCollection.void
addAppVersion
(AppVersion appVersion) Add an AppVersion representing a version of the analyzed application.void
addError
(AnalysisError error) Add an analysis error.void
Add an analysis error.void
addMissingClass
(String message) Add a missing class message.Get an Iterator over AppVersions defined in the collection.void
void
Clear all AppVersions representing previously-analyzed versions of the application.void
void
Create a new empty BugCollection with the same metadata as this one.long
Get the timestamp for when the analysis was performed.getAppVersionFromSequenceNumber
(long target) Gets the AppVersion corresponding to the given sequence number.Return the Collection storing the BugInstance objects.Get the current AppVersion.Get the project stats.Get the current release name.long
Get the sequence number of the BugCollection.long
Get the timestamp for the analyzed code (when it was compiled)boolean
Return whether textual messages will be added to any generated XMLboolean
boolean
boolean
iterator()
Return an Iterator over all the BugInstance objects in the BugCollection.lookupFromUniqueId
(String uniqueId) Deprecated.void
readXML
(InputStream in) Read XML data from given input stream into this object, populating the Project as a side effect.void
Read XML data from given reader into this object, populating the Project as a side effect.void
Read XML data from given file into this object, populating given Project as a side effect.void
setAnalysisTimestamp
(long timestamp) Set the timestamp for when the analysis was performed.void
setAnalysisVersion
(String analysisVersion) Set the version of FindBugs used to perform the analysisvoid
setApplySuppressions
(boolean applySuppressions) void
setClassFeatureSet
(ClassFeatureSet classFeatureSet) void
setMinimalXML
(boolean minimalXML) Set whether we should minimize XMLvoid
setReleaseName
(String releaseName) Set the current release name.void
setSequenceNumber
(long sequence) Set the sequence number of the BugCollection.void
setTimestamp
(long timestamp) Get the timestamp for the analyzed code (when it was compiled)void
setWithMessages
(boolean withMessages) Set whether textual messages should be added to any generated XMLorg.dom4j.Document
Convert the BugCollection into a dom4j Document object.void
writeEpilogue
(XMLOutput xmlOutput) void
writePrologue
(XMLOutput xmlOutput) void
Write the BugCollection to an XMLOutput object.void
writeXML
(OutputStream out) Write the BugCollection to given output stream as XML using a UTF8 encoding.void
Write the BugCollection to given output stream as XML.void
Write this BugCollection to a file as XML.Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
ROOT_ELEMENT_NAME
- See Also:
-
SRCMAP_ELEMENT_NAME
- See Also:
-
PROJECT_ELEMENT_NAME
- See Also:
-
ERRORS_ELEMENT_NAME
- See Also:
-
ANALYSIS_ERROR_ELEMENT_NAME
- See Also:
-
ERROR_ELEMENT_NAME
- See Also:
-
ERROR_MESSAGE_ELEMENT_NAME
- See Also:
-
ERROR_EXCEPTION_ELEMENT_NAME
- See Also:
-
ERROR_STACK_TRACE_ELEMENT_NAME
- See Also:
-
MISSING_CLASS_ELEMENT_NAME
- See Also:
-
SUMMARY_HTML_ELEMENT_NAME
- See Also:
-
APP_CLASS_ELEMENT_NAME
- See Also:
-
CLASS_HASHES_ELEMENT_NAME
- See Also:
-
HISTORY_ELEMENT_NAME
- See Also:
-
-
Method Details
-
getProject
Project getProject() -
setReleaseName
Set the current release name.- Parameters:
releaseName
- the current release name
-
getReleaseName
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
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
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
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
Add an AppVersion representing a version of the analyzed application.- Parameters:
appVersion
- the AppVersion
-
getCurrentAppVersion
AppVersion getCurrentAppVersion()Get the current AppVersion. -
appVersionIterator
Iterator<AppVersion> appVersionIterator()Get an Iterator over AppVersions defined in the collection. -
add
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
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.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
Add an analysis error.- Parameters:
message
- the error message
-
addError
Add an analysis error.- Parameters:
error
- the AnalysisError object to add
-
addMissingClass
Add a missing class message.- Parameters:
message
- the missing class message
-
setClassFeatureSet
-
writePrologue
- Throws:
IOException
-
writeEpilogue
- Throws:
IOException
-
clearClassFeatures
void clearClassFeatures() -
clearMissingClasses
void clearMissingClasses() -
readXML
Read XML data from given file into this object, populating given Project as a side effect.- Parameters:
fileName
- name of the file to read- Throws:
IOException
org.dom4j.DocumentException
-
readXML
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- Throws:
IOException
org.dom4j.DocumentException
-
readXML
Read 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:
IOException
org.dom4j.DocumentException
-
writeXML
Write this BugCollection to a file as XML.- Parameters:
fileName
- the file to write to- Throws:
IOException
-
writeXML
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- Throws:
IOException
-
writeXML
Write 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:
IOException
-
writeXML
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- Throws:
IOException
-
iterator
Iterator<BugInstance> iterator()Return an Iterator over all the BugInstance objects in the BugCollection.- Specified by:
iterator
in interfaceIterable<BugInstance>
-
getCollection
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
-
isApplySuppressions
boolean isApplySuppressions() -
setApplySuppressions
void setApplySuppressions(boolean applySuppressions) -
bugsPopulated
void bugsPopulated()
-