I spent yesterday refactoring my (work) code that delegated to WaitFor to extend it, and to use the TaskAdaptor to adapt it.

Only now, the extended task doesnt run. It gets created, it gets configured, but its execute() method never gets called, and neither does that of WaitFor(). I can be 100% sure of this, because it throws an exception when run: that exception is never raised.


    public void execute() throws BuildException {
        if(true) {
            throw new BuildException("in setproject");
        }
        ProjectHelper helper = new ProjectHelper(getProject());

        if(timeoutProperty==null) {
            String property;
            property = helper.createUniquePropertyName();
            setTimeoutProperty(property);
        }
log("About to wait for "+timeoutProperty+"; setting property "+timeoutProperty);
        super.execute();
        if(getProject().getProperty(timeoutProperty)!=null) {
            throw new BuildException(message);
        }
    }

this exception is never thrown. Nor is the parent class called; I've added some debug statements to WaitFor to be sure of that.

I can hypothesise two causes
-its a consequence of subclassing something that already has an execute() method.
-Somehow ant thinks it is a datatype, not a task.

when I throw a fault in setProject, this is the stack trace.

at org.smartfrog.tools.ant.FaultingWaitForTask.setProject(FaultingWaitForTask.java:83)
        at org.apache.tools.ant.Project.setProjectReference(Project.java:2179)
at org.apache.tools.ant.AntTypeDefinition.innerCreateAndSet(AntTypeDefinition.java:313) at org.apache.tools.ant.AntTypeDefinition.createAndSet(AntTypeDefinition.java:255) at org.apache.tools.ant.AntTypeDefinition.icreate(AntTypeDefinition.java:200) at org.apache.tools.ant.AntTypeDefinition.create(AntTypeDefinition.java:187) at org.apache.tools.ant.ComponentHelper.createComponent(ComponentHelper.java:239) at org.apache.tools.ant.ComponentHelper.createComponent(ComponentHelper.java:216)
        at 
org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:400)
at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:158)
        at org.apache.tools.ant.Task.perform(Task.java:368)

What is going on?


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to