FindBugs™ 1.3.9

edu.umd.cs.findbugs
Class FindBugs

java.lang.Object
  extended by edu.umd.cs.findbugs.FindBugs

public abstract class FindBugs
extends java.lang.Object

Static methods and fields useful for working with instances of IFindBugsEngine. This class was previously the main driver for FindBugs analyses, but has been replaced by FindBugs2.

Author:
Bill Pugh, David Hovemeyer

Field Summary
static boolean DEBUG
          Debug tracing.
static AnalysisFeatureSetting[] DEFAULT_EFFORT
          Analysis settings for -effort:default.
static java.util.Set<java.lang.String> knownURLProtocolSet
          Known URL protocols.
static AnalysisFeatureSetting[] LESS_EFFORT
          Analysis settings for -effort:less.
static AnalysisFeatureSetting[] MAX_EFFORT
          Analysis settings for -effort:max.
static AnalysisFeatureSetting[] MIN_EFFORT
          Analysis settings for -effort:min.
static long MINIMUM_TIMESTAMP
           
static AnalysisFeatureSetting[] MORE_EFFORT
          Analysis settings for -effort:more.
static boolean noAnalysis
           
 
Constructor Summary
FindBugs()
           
 
Method Summary
static void configureBaselineFilter(DelegatingBugReporter bugReporter, java.lang.String baselineFileName)
          Configure a baseline bug instance filter.
static void configureBugCollection(IFindBugsEngine findBugs)
          Configure the BugCollection (if the BugReporter being used is constructing one).
static void configureFilter(DelegatingBugReporter bugReporter, java.lang.String filterFileName, boolean include)
          Configure the (bug instance) Filter for the given DelegatingBugReporter.
static void configureTrainingDatabases(IFindBugsEngine findBugs)
          Configure training databases.
static java.lang.String getHome()
          Get the FindBugs home directory.
static java.util.Set<java.lang.String> handleBugCategories(UserPreferences userPreferences, java.lang.String categories)
          Process -bugCategories option.
static boolean isDetectorEnabled(IFindBugsEngine findBugs, DetectorFactory factory, int rankThreshold)
          Determing whether or not given DetectorFactory should be enabled.
static void processCommandLine(TextUICommandLine commandLine, java.lang.String[] argv, IFindBugsEngine findBugs)
          Process the command line.
static void runMain(IFindBugsEngine findBugs, TextUICommandLine commandLine)
          Given a fully-configured IFindBugsEngine and the TextUICommandLine used to configure it, execute the analysis.
static void setHome(java.lang.String home)
          Set the FindBugs home directory.
static void showCommandLineOptions()
          Print command line options synopses to stdout.
static void showCommandLineOptions(TextUICommandLine commandLine)
          Print command line options synopses to stdout.
static void showHelp(TextUICommandLine commandLine)
          Show -help message.
static void showSynopsis()
          Show the overall FindBugs command synopsis.
static boolean validTimestamp(long timestamp)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_EFFORT

public static final AnalysisFeatureSetting[] MIN_EFFORT
Analysis settings for -effort:min.


LESS_EFFORT

public static final AnalysisFeatureSetting[] LESS_EFFORT
Analysis settings for -effort:less.


DEFAULT_EFFORT

public static final AnalysisFeatureSetting[] DEFAULT_EFFORT
Analysis settings for -effort:default.


MORE_EFFORT

public static final AnalysisFeatureSetting[] MORE_EFFORT
Analysis settings for -effort:more.


MAX_EFFORT

public static final AnalysisFeatureSetting[] MAX_EFFORT
Analysis settings for -effort:max.


DEBUG

public static final boolean DEBUG
Debug tracing.


noAnalysis

public static boolean noAnalysis

knownURLProtocolSet

public static final java.util.Set<java.lang.String> knownURLProtocolSet
Known URL protocols. Filename URLs that do not have an explicit protocol are assumed to be files.


MINIMUM_TIMESTAMP

public static final long MINIMUM_TIMESTAMP
Constructor Detail

FindBugs

public FindBugs()
Method Detail

setHome

public static void setHome(java.lang.String home)
Set the FindBugs home directory.


getHome

public static java.lang.String getHome()
Get the FindBugs home directory.


configureTrainingDatabases

public static void configureTrainingDatabases(IFindBugsEngine findBugs)
                                       throws java.io.IOException
Configure training databases.

Parameters:
findBugs - the IFindBugsEngine to configure
Throws:
java.io.IOException

isDetectorEnabled

public static boolean isDetectorEnabled(IFindBugsEngine findBugs,
                                        DetectorFactory factory,
                                        int rankThreshold)
Determing whether or not given DetectorFactory should be enabled.

Parameters:
findBugs - the IFindBugsEngine
factory - the DetectorFactory
rankThreshold - TODO
Returns:
true if the DetectorFactory should be enabled, false otherwise

handleBugCategories

public static java.util.Set<java.lang.String> handleBugCategories(UserPreferences userPreferences,
                                                                  java.lang.String categories)
Process -bugCategories option.

Parameters:
userPreferences - UserPreferences representing which Detectors are enabled
categories - comma-separated list of bug categories
Returns:
Set of categories to be used

processCommandLine

public static void processCommandLine(TextUICommandLine commandLine,
                                      java.lang.String[] argv,
                                      IFindBugsEngine findBugs)
                               throws java.io.IOException,
                                      FilterException
Process the command line.

Parameters:
commandLine - the TextUICommandLine object which will parse the command line
argv - the command line arguments
findBugs - the IFindBugsEngine to configure
Throws:
java.io.IOException
FilterException

showHelp

public static void showHelp(TextUICommandLine commandLine)
Show -help message.

Parameters:
commandLine -

runMain

public static void runMain(IFindBugsEngine findBugs,
                           TextUICommandLine commandLine)
                    throws java.io.IOException,
                           java.lang.RuntimeException
Given a fully-configured IFindBugsEngine and the TextUICommandLine used to configure it, execute the analysis.

Parameters:
findBugs - a fully-configured IFindBugsEngine
commandLine - the TextUICommandLine used to configure the IFindBugsEngine
Throws:
java.io.IOException
java.lang.RuntimeException

showCommandLineOptions

public static void showCommandLineOptions()
Print command line options synopses to stdout.


showCommandLineOptions

public static void showCommandLineOptions(TextUICommandLine commandLine)
Print command line options synopses to stdout.

Parameters:
commandLine - the TextUICommandLine whose options should be printed

showSynopsis

public static void showSynopsis()
Show the overall FindBugs command synopsis.


configureFilter

public static void configureFilter(DelegatingBugReporter bugReporter,
                                   java.lang.String filterFileName,
                                   boolean include)
                            throws java.io.IOException,
                                   FilterException
Configure the (bug instance) Filter for the given DelegatingBugReporter.

Parameters:
bugReporter - a DelegatingBugReporter
filterFileName - filter file name
include - true if the filter is an include filter, false if it's an exclude filter
Throws:
java.io.IOException
FilterException

configureBaselineFilter

public static void configureBaselineFilter(DelegatingBugReporter bugReporter,
                                           java.lang.String baselineFileName)
                                    throws java.io.IOException,
                                           org.dom4j.DocumentException
Configure a baseline bug instance filter.

Parameters:
bugReporter - a DelegatingBugReporter
baselineFileName - filename of baseline Filter
Throws:
java.io.IOException
org.dom4j.DocumentException

configureBugCollection

public static void configureBugCollection(IFindBugsEngine findBugs)
Configure the BugCollection (if the BugReporter being used is constructing one).

Parameters:
findBugs - the IFindBugsEngine

validTimestamp

public static boolean validTimestamp(long timestamp)
Parameters:
timestamp -
Returns:

FindBugs™ 1.3.9

FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.