Hi Stefan,

Thank you the code changes. I shall go with the changed code.

However Stefan, not able to convince on why this can't be done
automatically, as it is so obvious that  new Copy Object is created while
wring the cutom tag extentions to ant. This code are used with in project
context and it gets invoked though custom xml  tags only in build file only.

I understand of explicit initialisation, if used as libarary in normal java
applications.

Regards,
Nagendra


Stefan Bodewig wrote:
> 
> On 2008-12-11, Raja Nagendra Kumar <nagendra.r...@tejasoft.com> wrote:
> 
>> Based on lifecycle link you provided I see that there is a mention
>> of
> 
>>> The task gets references to its project and location inside the
>>> buildfile via its inherited project and location variables.
> 
>> In such cases, why should the user initialise them explicitly, when
>> run from build file.
> 
> Because Ant can only intialize task it creates itself.
> 
>> Pl. suggest any other better approach, so that, when the user does not
>> explicitly intialise the task, it could take parents project and other
>> info
>> related to parent.
> 
> That would be the wrong approach.  The user is responsible for
> lifecycle handling when he creates tasks manually IMHO.  If your
> method was changed to read
> 
> private final Copy createCopyTask()
>     {
>       final Copy c = new Copy();
> +       c.bindToOwner(this);
> +       c.init();
>       c.setTodir(new File(getDestdir().getPath()));
>       c.setIncludeEmptyDirs(false);
>       c.setFailOnError(true);
>       c.setOverwrite(false);
>       c.setFlatten(false);
>       return c;
>     }
> 
> things should work as expected.
> 
> Ant really is not a general purpose API, if we wanted to make it one,
> we'd have bigger problems than providing default project instances.
> We shouldn't pretend it is one.
> 
> Stefan
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
> For additional commands, e-mail: dev-h...@ant.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/FileSet-with-copy-fails-with-NPE..-tp20935877p20970202.html
Sent from the Ant - Dev mailing list archive at Nabble.com.


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

Reply via email to