ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: FileSet with copy fails with NPE..
Date Thu, 11 Dec 2008 08:15:39 GMT
On 2008-12-11, Raja Nagendra Kumar <Nagendra.Raja@tejasoft.com> wrote:

> Pl. find the fix for the same in ProjectComponent

> We are defining a GOBAL_DEFAULT_PROJECT which would be same as the first non
> null setProject call parameter.

That would be a pretty bad idea, in particular in the presence of
<ant> tasks and maybe even <parallel>.

Generally Ant's API is not designed to be used in an embedded way and
if you create any sort of task programatically you better make sure it
is initialized properly, which includes setting the project instance.

If you create a task programatically, make sure you implement the full
lifecycles as defined
<http://ant.apache.org/manual/develop.html#writingowntask> because the
existing task will depend on it.

I don't see you method setting the location, owning target or invoking
init() either, which might get you in trouble as well.

You may want to use Task.bindToOwner() to copy the most important
properties from your current task to the manualy created copy task but
should still invoke init() (some tasks use it, Copy does not).

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message