You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by gl...@ca.ibm.com on 2000/06/01 15:21:46 UTC

Re: Validating task attributes




You could do it at either time; it really depends on the task and how soon
you want to catch potential errors.  Any property replacement for an
attribute is done at parse time (well, right now anyway.  The proposed spec
indicates that it should be done just before target execution -
http://jakarta.apache.org/cvsweb/index.cgi/jakarta-ant/spec/core.html).  If
you want your whole build to fail due to bad attribute values, I would
throw a BuildException during your init() method.  If you want more control
and the ability to fail gracefully, I would suggest doing damage control
during the execute() method.

My $0.02.

Glenn McAllister
TID - Software Developer - VisualAge for Java
IBM Toronto Lab, (416) 448-3805
"An approximate answer to the right question is better than the
right answer to the wrong question." - John W. Tukey


When is the appropriate time to validate the values of the attributes for a
task: when the attribute is set (I assume this happens at parse time), or
when the attribute would be used (for instance, in execute())?

----------
Craig S. Cottingham
ccottingham@euronetservices.com
PGP key available from:
<http://pgp.ai.mit.edu:11371/pks/lookup?op=get&search=0xA2FFBE41>
PGP ID=0xA2FFBE41
PGP fingerprint=6AA8 2E28 2404 8A95 B8FC 7EFC 136F 0CEF A2FF BE41