Improve DefaultAntTaskFactory so that it can create Ant tasks for tasks requiring a valid Ant Target object


From the mailing list:

my name is Petar Tahchiev, and I have been working with the cactus-ant-tasks integration with Cargo lately. The problem is that I want to use cargo's DefaultAntTaskFactory
but it has only one constructor that accepts ant's Project object. In that constructor you set the project instance variable, and all of the instance variables get initialized with some default values. Specifically you instantiate new Target(); The probblem comes when one tries to use the DefaultAntTaskFactory to create "antcall" task, because in the ant API the target's name is tested to see if the <antcall> task is executed within some target. So since you create the target via new Target(), the name of the target is never initialised and stays null, forever. Thus a null-pointer exception is thrown.

In the RunServerTests cactus task, we use only antcalls. In the cactus API (Vincent surely knows what I am so desparately trying to explain ) we also have a DefaultAntTaskFactory. So my idea is to replace ours with the one you gyus provide.

To summon up my wish is to look at the patch I supply with this email and tell me: is it possible to add another constructor to the DefaultAntTaskFactory with the following syntacsis:
public DefaultAntTaskFactory(Project theProject,
String theCurrentTaskName, Location theCurrentLocation,
Target theCurrentTarget)



Vincent Massol


Petar Tahchiev


Fix versions

Affects versions