Interface BugCollection

    • Field Detail

      • PROJECT_ELEMENT_NAME

        static final java.lang.String PROJECT_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_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

      • 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 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
      • 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 interface java.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()