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.String
ANALYSIS_ERROR_ELEMENT_NAME
static java.lang.String
APP_CLASS_ELEMENT_NAME
static java.lang.String
CLASS_HASHES_ELEMENT_NAME
static java.lang.String
ERROR_ELEMENT_NAME
static java.lang.String
ERROR_EXCEPTION_ELEMENT_NAME
static java.lang.String
ERROR_MESSAGE_ELEMENT_NAME
static java.lang.String
ERROR_STACK_TRACE_ELEMENT_NAME
static java.lang.String
ERRORS_ELEMENT_NAME
static java.lang.String
HISTORY_ELEMENT_NAME
static java.lang.String
MISSING_CLASS_ELEMENT_NAME
static java.lang.String
PROJECT_ELEMENT_NAME
static java.lang.String
ROOT_ELEMENT_NAME
static java.lang.String
SRCMAP_ELEMENT_NAME
static java.lang.String
SUMMARY_HTML_ELEMENT_NAME
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description boolean
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
addError(java.lang.String message)
Add an analysis error.void
addMissingClass(java.lang.String message)
Add a missing class message.java.util.Iterator<AppVersion>
appVersionIterator()
Get an Iterator over AppVersions defined in the collection.void
bugsPopulated()
void
clearAppVersions()
Clear all AppVersions representing previously-analyzed versions of the application.void
clearClassFeatures()
void
clearMissingClasses()
BugCollection
createEmptyCollectionWithMetadata()
Create a new empty BugCollection with the same metadata as this one.BugInstance
findBug(java.lang.String instanceHash, java.lang.String bugType, int lineNumber)
long
getAnalysisTimestamp()
Get the timestamp for when the analysis was performed.AppVersion
getAppVersionFromSequenceNumber(long target)
Gets the AppVersion corresponding to the given sequence number.java.util.Collection<BugInstance>
getCollection()
Return the Collection storing the BugInstance objects.AppVersion
getCurrentAppVersion()
Get the current AppVersion.Project
getProject()
ProjectStats
getProjectStats()
Get the project stats.java.lang.String
getReleaseName()
Get the current release name.long
getSequenceNumber()
Get the sequence number of the BugCollection.long
getTimestamp()
Get the timestamp for the analyzed code (when it was compiled)boolean
getWithMessages()
Return whether textual messages will be added to any generated XMLboolean
hasDeadBugs()
boolean
isApplySuppressions()
boolean
isMultiversion()
java.util.Iterator<BugInstance>
iterator()
Return an Iterator over all the BugInstance objects in the BugCollection.BugInstance
lookupFromUniqueId(java.lang.String uniqueId)
Deprecated.void
readXML(java.io.InputStream in)
Read XML data from given input stream into this object, populating the Project as a side effect.void
readXML(java.io.Reader reader)
Read XML data from given reader into this object, populating the Project as a side effect.void
readXML(java.lang.String fileName)
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(java.lang.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(java.lang.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
toDocument()
Convert the BugCollection into a dom4j Document object.void
writeEpilogue(XMLOutput xmlOutput)
void
writePrologue(XMLOutput xmlOutput)
void
writeXML(XMLOutput xmlOutput)
Write the BugCollection to an XMLOutput object.void
writeXML(java.io.OutputStream out)
Write the BugCollection to given output stream as XML using a UTF8 encoding.void
writeXML(java.io.Writer out)
Write the BugCollection to given output stream as XML.void
writeXML(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.DocumentException
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:
java.io.IOException
org.dom4j.DocumentException
-
readXML
void readXML(@WillClose java.io.InputStream in) throws java.io.IOException, org.dom4j.DocumentException
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:
java.io.IOException
org.dom4j.DocumentException
-
readXML
void readXML(@WillClose java.io.Reader reader) throws java.io.IOException, org.dom4j.DocumentException
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:
java.io.IOException
org.dom4j.DocumentException
-
writeXML
void writeXML(java.lang.String fileName) throws java.io.IOException
Write 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.IOException
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:
java.io.IOException
-
writeXML
void writeXML(@WillClose java.io.OutputStream out) throws java.io.IOException
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:
java.io.IOException
-
writeXML
void writeXML(@WillClose XMLOutput xmlOutput) throws java.io.IOException
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:
java.io.IOException
-
iterator
java.util.Iterator<BugInstance> iterator()
Return an Iterator over all the BugInstance objects in the BugCollection.- Specified by:
iterator
in 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)
-
bugsPopulated
void bugsPopulated()
-
-