You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Craig Cottingham <cc...@euronetservices.com> on 2000/05/31 22:38:46 UTC

Validating task attributes

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

Re: Validating task attributes

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "CC" == Craig Cottingham <cc...@euronetservices.com> writes:

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

First, yes you are right, attributes are set at parse time right now.

If you want to throw a BuildException on malformed attributes execute
is your only clean choice - as the setters shouldn't throw any
Exceptions at all. If you just want to print a warning you can do it
in the setter method.

In some cases execute is your only choice anyway - when two attributes
depend on each other for example.

Stefan