Class AnalysisRun


  • public class AnalysisRun
    extends java.lang.Object
    Representation of a run of the FindBugs analysis on a Project. This class has convenient methods which can be used to extract bug reports in various interesting ways.
    Author:
    David Hovemeyer
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void execute​(FindBugsProgress progressCallback)
      Run the analysis.
      java.util.Collection<BugInstance> getBugInstances()
      Return the collection of BugInstances.
      FindBugsFrame getFrame()
      Get the FindBugsFrame which created this analysis run.
      java.lang.String getSummary()  
      javax.swing.tree.DefaultTreeModel getTreeModel​(java.lang.String groupByOrder)
      Get the tree model to be used in the BugTree.
      void loadBugsFromFile​(java.io.File file)
      Load bugs from a file.
      void loadBugsFromInputStream​(java.io.InputStream in)
      Load bugs from an InputStream.
      void reportAnalysisErrors()
      Report any errors that may have occurred during analysis.
      void saveBugsToFile​(java.io.File file)
      Save bugs to a file.
      void setTreeModel​(java.lang.String groupByOrder, javax.swing.tree.DefaultTreeModel treeModel)
      Set the tree model to be used in the BugTree.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AnalysisRun

        public AnalysisRun​(Project project,
                           FindBugsFrame frame)
        Creates a new instance of AnalysisRun.
    • Method Detail

      • getFrame

        public FindBugsFrame getFrame()
        Get the FindBugsFrame which created this analysis run.
        Returns:
        the FindBugsFrame
      • execute

        public void execute​(FindBugsProgress progressCallback)
                     throws java.io.IOException,
                            java.lang.InterruptedException
        Run the analysis. This should be done in a separate thread (not the GUI event thread). The progress callback can be used to update the user interface to reflect the progress of the analysis. The GUI may cancel the analysis by interrupting the analysis thread, in which case InterruptedException will be thrown by this method.
        Parameters:
        progressCallback - the progress callback
        Throws:
        java.io.IOException - if an I/O error occurs during the analysis
        java.lang.InterruptedException - if the analysis thread is interrupted
      • loadBugsFromFile

        public void loadBugsFromFile​(java.io.File file)
                              throws java.io.IOException,
                                     org.dom4j.DocumentException
        Load bugs from a file.
        Throws:
        java.io.IOException
        org.dom4j.DocumentException
      • loadBugsFromInputStream

        public void loadBugsFromInputStream​(java.io.InputStream in)
                                     throws java.io.IOException,
                                            org.dom4j.DocumentException
        Load bugs from an InputStream.
        Parameters:
        in - the InputStream
        Throws:
        java.io.IOException
        org.dom4j.DocumentException
      • saveBugsToFile

        public void saveBugsToFile​(java.io.File file)
                            throws java.io.IOException
        Save bugs to a file.
        Throws:
        java.io.IOException
      • reportAnalysisErrors

        public void reportAnalysisErrors()
        Report any errors that may have occurred during analysis.
      • getBugInstances

        public java.util.Collection<BugInstance> getBugInstances()
        Return the collection of BugInstances.
      • setTreeModel

        public void setTreeModel​(java.lang.String groupByOrder,
                                 javax.swing.tree.DefaultTreeModel treeModel)
        Set the tree model to be used in the BugTree.
        Parameters:
        groupByOrder - the grouping order that the tree model will conform to
        treeModel - the tree model
      • getTreeModel

        public javax.swing.tree.DefaultTreeModel getTreeModel​(java.lang.String groupByOrder)
        Get the tree model to be used in the BugTree.
        Parameters:
        groupByOrder - the grouping order that the tree model conforms to
        Returns:
        the tree model
      • getSummary

        public java.lang.String getSummary()