bodewig 01/08/21 22:51:48
Modified: docs/manual/CoreTasks Tag: ANT_14_BRANCH property.html
src/main/org/apache/tools/ant/taskdefs Tag: ANT_14_BRANCH
Property.java
Log:
Enforce meaningful attribute combinations in <property> and make the
docs match the implementation a little closer.
Revision Changes Path
No revision
No revision
1.3.2.2 +13 -10 jakarta-ant/docs/manual/CoreTasks/property.html
Index: property.html
===================================================================
RCS file: /home/cvs/jakarta-ant/docs/manual/CoreTasks/property.html,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -u -r1.3.2.1 -r1.3.2.2
--- property.html 2001/08/09 15:09:56 1.3.2.1
+++ property.html 2001/08/22 05:51:48 1.3.2.2
@@ -48,14 +48,23 @@
<tr>
<td valign="top">name</td>
<td valign="top">the name of the property to set.</td>
- <td valign="top" align="center">Yes</td>
+ <td valign="top" align="center">No</td>
</tr>
<tr>
<td valign="top">value</td>
<td valign="top">the value of the property.</td>
- <td valign="middle" align="center" rowspan="6">Yes</td>
+ <td valign="middle" align="center" rowspan="3">One of these, when using
the
+ name attribute</td>
</tr>
<tr>
+ <td valign="top">location</td>
+ <td valign="top">Sets the property to the absolute filename of the
+ given file. If the value of this attribute is an absolute path, it
+ is left unchanged (with / and \ characters converted to the
+ current platforms conventions). Otherwise it is taken as a path
+ relative to the project's basedir and expanded.</td>
+ </tr>
+ <tr>
<td valign="top">refid</td>
<td valign="top"><a href="../using.html#references">Reference</a> to an
object
defined elsewhere. Only yields reasonable results for references
@@ -64,18 +73,12 @@
<tr>
<td valign="top">resource</td>
<td valign="top">the resource name of the property file.</td>
+ <td valign="middle" align="center" rowspan="3">One of these, when
+ <b>not</b> using the name attribute</td>
</tr>
<tr>
<td valign="top">file</td>
<td valign="top">the filename of the property file .</td>
- </tr>
- <tr>
- <td valign="top">location</td>
- <td valign="top">Sets the property to the absolute filename of the
- given file. If the value of this attribute is an absolute path, it
- is left unchanged (with / and \ characters converted to the
- current platforms conventions). Otherwise it is taken as a path
- relative to the project's basedir and expanded.</td>
</tr>
<tr>
<td valign="top">environment</td>
No revision
No revision
1.31.2.1 +12 -0
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Property.java
Index: Property.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Property.java,v
retrieving revision 1.31
retrieving revision 1.31.2.1
diff -u -r1.31 -r1.31.2.1
--- Property.java 2001/07/31 11:24:41 1.31
+++ Property.java 2001/08/22 05:51:48 1.31.2.1
@@ -160,6 +160,18 @@
}
public void execute() throws BuildException {
+ if (name != null) {
+ if (value == null && ref == null) {
+ throw new BuildException("You must specify value, location
or refid with the name attribute",
+ location);
+ }
+ } else {
+ if (file == null && resource == null && env == null) {
+ throw new BuildException("You must specify file, resource or
environment when not using the name attribute",
+ location);
+ }
+ }
+
if ((name != null) && (value != null)) {
addProperty(name, value);
}