You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Stephen Nesbitt <sn...@cobaltgroup.com> on 2005/10/19 03:20:42 UTC
Need Help Extending Copy Task
All:
I'm trying to extend the the copy task and am running into a brick wall.
What I am trying to do is to extend the task so that it can accept a property
which contains a comma separated list of FileSet references. For example:
<my:copy dir="thisDir" filesetlist="thisRef,thatRef" />. my:copy would do
nothing more than parse filesetlist and call the copy task for each
reference.
I thought I should be able to do something like this:
Copy newCopy = new Copy();
newCopy.setTodir(new File(thisDir));
newCopy.addFileset( (FileSet) getProject().getReference(thisRef));
newCopy.execute();
This isn't working - I get a null pointer exception on line 382 of
AbstractFileSet on the statement:
p.log(getDataTypeName() + ": Setup scanner in dir " + dir
+ " with " + defaultPatterns, Project.MSG_DEBUG);
I believe it is choking on defaultPatterns.
I am undoubtedly missing something obvious, but would appreciate some guidance
(and forbearance!)
-steve
--
Stephen Nesbitt
Senior Configuration Management Engineer
The Cobalt Group
snesbitt@cobaltgroup.com
x8271
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Need Help Extending Copy Task
Posted by Stephen Nesbitt <sn...@cobaltgroup.com>.
On Wednesday 19 October 2005 01:01, Steve Loughran wrote:
> question: where does this newCopy get its project to log to?
>
> Because I dont see you passing it down, and I would centainly expect
> project.log() to NPE when it is null -which is exactly what appears to
> be happening.
>
> newCopy.setProject(getProject())
Bingo! And duh!
Thanks!
-steve
--
Stephen Nesbitt
Senior Configuration Management Engineer
The Cobalt Group
snesbitt@cobaltgroup.com
x8271
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Need Help Extending Copy Task
Posted by Steve Loughran <st...@apache.org>.
Stephen Nesbitt wrote:
> All:
>
> I'm trying to extend the the copy task and am running into a brick wall.
>
> What I am trying to do is to extend the task so that it can accept a property
> which contains a comma separated list of FileSet references. For example:
> <my:copy dir="thisDir" filesetlist="thisRef,thatRef" />. my:copy would do
> nothing more than parse filesetlist and call the copy task for each
> reference.
>
> I thought I should be able to do something like this:
>
> Copy newCopy = new Copy();
> newCopy.setTodir(new File(thisDir));
> newCopy.addFileset( (FileSet) getProject().getReference(thisRef));
> newCopy.execute();
>
> This isn't working - I get a null pointer exception on line 382 of
> AbstractFileSet on the statement:
> p.log(getDataTypeName() + ": Setup scanner in dir " + dir
> + " with " + defaultPatterns, Project.MSG_DEBUG);
>
> I believe it is choking on defaultPatterns.
>
> I am undoubtedly missing something obvious, but would appreciate some guidance
> (and forbearance!)
question: where does this newCopy get its project to log to?
Because I dont see you passing it down, and I would centainly expect
project.log() to NPE when it is null -which is exactly what appears to
be happening.
newCopy.setProject(getProject())
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org