Package edu.umd.cs.findbugs.anttask
Class AbstractFindBugsTask
- java.lang.Object
-
- org.apache.tools.ant.ProjectComponent
-
- org.apache.tools.ant.Task
-
- edu.umd.cs.findbugs.anttask.AbstractFindBugsTask
-
- All Implemented Interfaces:
java.lang.Cloneable
- Direct Known Subclasses:
ComputeBugHistoryTask,ConvertXmlToTextTask,FilterBugsTask,FindBugsTask,MineBugHistoryTask,SetBugDatabaseInfoTask,UnionBugs2
public abstract class AbstractFindBugsTask extends org.apache.tools.ant.TaskAbstract base class for Ant tasks that run programs (main() methods) in findbugs.jar or findbugsGUI.jar.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractFindBugsTask.SystemProperty
-
Field Summary
Fields Modifier and Type Field Description private org.apache.tools.ant.types.Pathclasspathprivate booleandebugstatic longDEFAULT_TIMEOUTprotected java.lang.StringerrorPropertyjava.lang.StringexecResultPropertyprivate booleanfailOnErrorstatic java.lang.StringFINDBUGS_JARprivate org.apache.tools.ant.taskdefs.JavafindbugsEngineprivate java.io.FilehomeDirprivate java.lang.Stringjvmprivate java.lang.Stringjvmargsprivate java.lang.StringmainClassprivate org.apache.tools.ant.types.PathpluginListstatic java.lang.StringRESULT_PROPERTY_SUFFIXprivate java.util.List<AbstractFindBugsTask.SystemProperty>systemPropertyListprivate longtimeout
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractFindBugsTask(java.lang.String mainClass)Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddArg(java.lang.String arg)Add an argument to the JVM used to execute FindBugs.protected voidafterExecuteJavaProcess(int rc)protected abstract voidbeforeExecuteJavaProcess()protected voidcheckParameters()Check that all required attributes have been set.protected abstract voidconfigureFindbugsEngine()org.apache.tools.ant.types.PathcreateClasspath()Path to use for classpath.protected voidcreateFindbugsEngine()Create the FindBugs engine (the Java process that will run whatever FindBugs-related program this task is going to execute).org.apache.tools.ant.types.PathcreatePluginList()Path to use for plugin list.AbstractFindBugsTask.SystemPropertycreateSystemProperty()Create a SystemProperty (to handle <systemProperty> elements).private voidexecFindbugs()Create a new JVM to do the work.voidexecute()protected booleangetDebug()Get the debug flag.protected org.apache.tools.ant.taskdefs.JavagetFindbugsEngine()Get the Findbugs engine.voidsetClasspath(org.apache.tools.ant.types.Path src)Set the classpath to use.voidsetClasspathRef(org.apache.tools.ant.types.Reference r)Adds a reference to a classpath defined elsewhere.voidsetDebug(boolean flag)Set the debug flagvoidsetErrorProperty(java.lang.String name)Tells this task to set the property with the given name to "true" when there were errors.voidsetFailOnError(boolean flag)Set the failOnError flagvoidsetHome(java.io.File homeDir)Set the home directory into which spotbugs was installedprotected voidsetInputString(java.lang.String input)Sets the given string to be piped to standard input of the FindBugs JVM upon launching.voidsetJvm(java.lang.String jvm)Set the command used to start the VMvoidsetJvmargs(java.lang.String args)Set any specific jvm argsvoidsetPluginList(org.apache.tools.ant.types.Path src)the plugin list to use.voidsetPluginListRef(org.apache.tools.ant.types.Reference r)Adds a reference to a plugin list defined elsewhere.voidsetTimeout(long timeout)Set timeout in milliseconds.-
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
-
-
-
-
Field Detail
-
FINDBUGS_JAR
public static final java.lang.String FINDBUGS_JAR
- See Also:
- Constant Field Values
-
DEFAULT_TIMEOUT
public static final long DEFAULT_TIMEOUT
- See Also:
- Constant Field Values
-
RESULT_PROPERTY_SUFFIX
public static final java.lang.String RESULT_PROPERTY_SUFFIX
- See Also:
- Constant Field Values
-
mainClass
private final java.lang.String mainClass
-
debug
private boolean debug
-
homeDir
private java.io.File homeDir
-
jvm
private java.lang.String jvm
-
jvmargs
private java.lang.String jvmargs
-
timeout
private long timeout
-
failOnError
private boolean failOnError
-
errorProperty
protected java.lang.String errorProperty
-
systemPropertyList
private final java.util.List<AbstractFindBugsTask.SystemProperty> systemPropertyList
-
classpath
private org.apache.tools.ant.types.Path classpath
-
pluginList
private org.apache.tools.ant.types.Path pluginList
-
findbugsEngine
private org.apache.tools.ant.taskdefs.Java findbugsEngine
-
execResultProperty
public java.lang.String execResultProperty
-
-
Method Detail
-
setHome
public void setHome(java.io.File homeDir)
Set the home directory into which spotbugs was installed- Parameters:
homeDir- installation directory
-
setDebug
public void setDebug(boolean flag)
Set the debug flag- Parameters:
flag-trueto enable debugging
-
getDebug
protected boolean getDebug()
Get the debug flag.
-
setJvmargs
public void setJvmargs(java.lang.String args)
Set any specific jvm args- Parameters:
args- JVM arguments
-
setJvm
public void setJvm(java.lang.String jvm)
Set the command used to start the VM- Parameters:
jvm- command used to start the VM
-
setTimeout
public void setTimeout(long timeout)
Set timeout in milliseconds.- Parameters:
timeout- the timeout
-
setFailOnError
public void setFailOnError(boolean flag)
Set the failOnError flag- Parameters:
flag-trueto enable
-
setErrorProperty
public void setErrorProperty(java.lang.String name)
Tells this task to set the property with the given name to "true" when there were errors.- Parameters:
name- property to set to "true" on errors
-
createSystemProperty
public AbstractFindBugsTask.SystemProperty createSystemProperty()
Create a SystemProperty (to handle <systemProperty> elements).- Returns:
- new property
-
setClasspath
public void setClasspath(org.apache.tools.ant.types.Path src)
Set the classpath to use.- Parameters:
src- classpath to use
-
createClasspath
public org.apache.tools.ant.types.Path createClasspath()
Path to use for classpath.- Returns:
- path to use for classpath
-
setClasspathRef
public void setClasspathRef(org.apache.tools.ant.types.Reference r)
Adds a reference to a classpath defined elsewhere.- Parameters:
r- reference to a classpath defined elsewhere
-
setPluginList
public void setPluginList(org.apache.tools.ant.types.Path src)
the plugin list to use.- Parameters:
src- plugin list to use
-
createPluginList
public org.apache.tools.ant.types.Path createPluginList()
Path to use for plugin list.- Returns:
- path to use for plugin list
-
setPluginListRef
public void setPluginListRef(org.apache.tools.ant.types.Reference r)
Adds a reference to a plugin list defined elsewhere.- Parameters:
r- reference to a plugin list defined elsewhere
-
execute
public void execute() throws org.apache.tools.ant.BuildException- Overrides:
executein classorg.apache.tools.ant.Task- Throws:
org.apache.tools.ant.BuildException
-
checkParameters
protected void checkParameters()
Check that all required attributes have been set.
-
createFindbugsEngine
protected void createFindbugsEngine()
Create the FindBugs engine (the Java process that will run whatever FindBugs-related program this task is going to execute).
-
getFindbugsEngine
protected org.apache.tools.ant.taskdefs.Java getFindbugsEngine()
Get the Findbugs engine.
-
addArg
protected void addArg(java.lang.String arg)
Add an argument to the JVM used to execute FindBugs.- Parameters:
arg- the argument
-
setInputString
protected void setInputString(java.lang.String input)
Sets the given string to be piped to standard input of the FindBugs JVM upon launching.
-
execFindbugs
private void execFindbugs() throws org.apache.tools.ant.BuildExceptionCreate a new JVM to do the work.- Throws:
org.apache.tools.ant.BuildException- Since:
- Ant 1.5
-
configureFindbugsEngine
protected abstract void configureFindbugsEngine()
-
beforeExecuteJavaProcess
protected abstract void beforeExecuteJavaProcess()
-
afterExecuteJavaProcess
protected void afterExecuteJavaProcess(int rc)
-
-