bodewig 01/12/12 01:03:32
Modified: docs/manual/CoreTasks waitfor.html
src/main/org/apache/tools/ant/taskdefs WaitFor.java
Log:
Make <waitfor> set a property instead of throwing an exception if the
maximum time to wait has been exceeded.
Revision Changes Path
1.4 +9 -0 jakarta-ant/docs/manual/CoreTasks/waitfor.html
Index: waitfor.html
===================================================================
RCS file: /home/cvs/jakarta-ant/docs/manual/CoreTasks/waitfor.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- waitfor.html 2001/12/05 20:30:49 1.3
+++ waitfor.html 2001/12/12 09:03:31 1.4
@@ -16,6 +16,9 @@
if multiple conditions are specified, then the task will wait until all
conditions are true..</p>
<p></p>
<p>If both maxwait and maxwaitunit are not specified, the maxwait is 3
minutes (180000 milliseconds).</p>
+<p>If the <code>timeoutproperty</code> attribute has been set, a
+property of that name will be created if the condition didn't come
+true within the specified time.</p>
<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
@@ -65,6 +68,12 @@
<li>week</li>
</ul>
</td>
+ <td valign="top" align="center">No</td>
+ </tr>
+ <tr>
+ <td valign="top">timeoutproperty</td>
+ <td valign="top">the name of the property to set if maxwait has
+ been exceeded.</td>
<td valign="top" align="center">No</td>
</tr>
</table>
1.4 +12 -1
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/WaitFor.java
Index: WaitFor.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/WaitFor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- WaitFor.java 2001/12/06 14:33:40 1.3
+++ WaitFor.java 2001/12/12 09:03:31 1.4
@@ -74,6 +74,7 @@
* <li>maxwaitunit - The unit to be used to interpret maxwait attribute</li>
* <li>checkevery - amount of time to sleep between each check</li>
* <li>checkeveryunit - The unit to be used to interpret checkevery
attribute</li>
+ * <li>timeoutproperty - name of a property to set if maxwait has been
exceeded.</li>
* </ul>
*
* The maxwaitunit and checkeveryunit are allowed to have the following
values:
@@ -88,6 +89,7 @@
private long maxWaitMultiplier = 1l;
private long checkEveryMillis = 500l;
private long checkEveryMultiplier = 1l;
+ private String timeoutProperty;
/**
* Set the maximum length of time to wait
@@ -118,6 +120,13 @@
}
/**
+ * Set the timeout property.
+ */
+ public void setTimeoutProperty(String p) {
+ timeoutProperty = p;
+ }
+
+ /**
* Check repeatedly for the specified conditions until they become
* true or the timeout expires.
*/
@@ -145,7 +154,9 @@
}
}
- throw new BuildException("Task did not complete in time");
+ if (timeoutProperty != null) {
+ project.setNewProperty(timeoutProperty, "true");
+ }
}
public static class Unit extends EnumeratedAttribute {
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>