|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
ise.antelope.tasks.TryTask
public class TryTask
Try is a container task - it can contain other Ant tasks. The nested tasks are simply executed in sequence. Try's primary use is to support the try/catch-like execution of a set of tasks. If any of the child tasks fail (that is, they throw a build exception), the exception is caught and the build can continue. This is sometimes useful for tasks that can fail, but it isn't necessary to fail the build if they do. For example, the "mail" task may fail if the server is unavailable, but not sending the message may not be critical to the build continuing.
Field Summary |
---|
Fields inherited from class org.apache.tools.ant.Task |
---|
target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
---|
description, location, project |
Constructor Summary | |
---|---|
TryTask()
|
Method Summary | |
---|---|
void |
addCatch(CatchTask task)
|
void |
addFinally(FinallyTask task)
|
void |
addTask(org.apache.tools.ant.Task task)
Add a nested task to Try. |
void |
execute()
Try to execute all tasks. |
void |
init()
make sure dependent tasks are loaded |
void |
maybeConfigure()
Override maybeConfigure
in a way that leaves the nested tasks unconfigured until they get
executed. |
void |
setBreak(boolean b)
A try block may contain several tasks. |
void |
setMessageproperty(java.lang.String name)
the error message of the exception can be stored as a property |
void |
setPrintmessage(boolean b)
If printstacktrace is set to true, this is ignored as the error message is printed as part of the stack trace. |
void |
setPrintstacktrace(boolean b)
Default is to not print the stack trace. |
void |
setStacktraceproperty(java.lang.String name)
the stack trace can be stored as a property |
Methods inherited from class org.apache.tools.ant.Task |
---|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, log, log, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
---|
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TryTask()
Method Detail |
---|
public void init()
init
in class org.apache.tools.ant.Task
public void maybeConfigure() throws org.apache.tools.ant.BuildException
maybeConfigure
in a way that leaves the nested tasks unconfigured until they get
executed.
maybeConfigure
in class org.apache.tools.ant.Task
org.apache.tools.ant.BuildException
- Description of Exceptionpublic void addTask(org.apache.tools.ant.Task task)
addTask
in interface org.apache.tools.ant.TaskContainer
task
- Nested task to try to executepublic void addCatch(CatchTask task)
public void addFinally(FinallyTask task)
public void setBreak(boolean b)
b
- if set to false, the try block will execute all tasks in the
block, regardless of failure of an individual task.public void setPrintmessage(boolean b)
b
- Should the error message of a failed task be logged?public void setMessageproperty(java.lang.String name)
public void setPrintstacktrace(boolean b)
b
- Should the stack trace of a failed task be logged?public void setStacktraceproperty(java.lang.String name)
public void execute() throws org.apache.tools.ant.BuildException
execute
in class org.apache.tools.ant.Task
org.apache.tools.ant.BuildException
- Description of Exception
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |