diff --git a/src/main/org/apache/tools/ant/taskdefs/Ant.java b/src/main/org/apache/tools/ant/taskdefs/Ant.java index f98594f64..b3c5df812 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Ant.java +++ b/src/main/org/apache/tools/ant/taskdefs/Ant.java @@ -108,6 +108,23 @@ public class Ant extends Task { /** whether the target attribute was specified **/ private boolean targetAttributeSet = false; + /** + * simple constructor + */ + public Ant() { + } + + /** + * create a task bound to its creator + * @param owner owning task + */ + public Ant(Task owner) { + bindToOwner(owner); + } + + + + /** * If true, pass all properties to the new Ant project. * Defaults to true. diff --git a/src/main/org/apache/tools/ant/taskdefs/CallTarget.java b/src/main/org/apache/tools/ant/taskdefs/CallTarget.java index 60330ca4f..f96c0f328 100644 --- a/src/main/org/apache/tools/ant/taskdefs/CallTarget.java +++ b/src/main/org/apache/tools/ant/taskdefs/CallTarget.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2004 The Apache Software Foundation + * Copyright 2000-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -80,10 +80,7 @@ public class CallTarget extends Task { * configuring it by calling its own init method. */ public void init() { - callee = (Ant) getProject().createTask("ant"); - callee.setOwningTarget(getOwningTarget()); - callee.setTaskName(getTaskName()); - callee.setLocation(getLocation()); + callee = new Ant(this); callee.init(); } diff --git a/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java b/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java index 1db939546..3f312c03b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java +++ b/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java @@ -1,5 +1,5 @@ /* - * Copyright 2000,2002,2004 The Apache Software Foundation + * Copyright 2000,2002,2004-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -354,7 +354,7 @@ public class GenerateKey extends Task { } log("Generating Key for " + alias); - final ExecTask cmd = (ExecTask) getProject().createTask("exec"); + final ExecTask cmd = new ExecTask(this); cmd.setExecutable(JavaEnvUtils.getJdkExecutable("keytool")); Commandline.Argument arg = cmd.createArg(); arg.setLine(sb.toString()); diff --git a/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java b/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java index af3c80ad0..1f0c68107 100644 --- a/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java +++ b/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2004 The Apache Software Foundation + * Copyright 2002-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -216,9 +216,8 @@ public class LoadProperties extends Task { final Properties props = new Properties(); props.load(tis); - Property propertyTask = - (Property) getProject().createTask("property"); - propertyTask.setTaskName(getTaskName()); + Property propertyTask = new Property(); + propertyTask.bindToOwner(this); propertyTask.addProperties(props); } diff --git a/src/main/org/apache/tools/ant/taskdefs/SignJar.java b/src/main/org/apache/tools/ant/taskdefs/SignJar.java index 5deb4718d..35d68e772 100644 --- a/src/main/org/apache/tools/ant/taskdefs/SignJar.java +++ b/src/main/org/apache/tools/ant/taskdefs/SignJar.java @@ -269,8 +269,7 @@ public class SignJar extends Task { } long lastModified = jarSource.lastModified(); - final ExecTask cmd = new ExecTask(); - cmd.setProject(getProject()); + final ExecTask cmd = new ExecTask(this); cmd.setExecutable(JavaEnvUtils.getJdkExecutable("jarsigner")); if (maxMemory != null) { diff --git a/src/main/org/apache/tools/ant/taskdefs/SubAnt.java b/src/main/org/apache/tools/ant/taskdefs/SubAnt.java index d70c45f88..1c8d45c45 100644 --- a/src/main/org/apache/tools/ant/taskdefs/SubAnt.java +++ b/src/main/org/apache/tools/ant/taskdefs/SubAnt.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2004 The Apache Software Foundation + * Copyright 2003-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -478,9 +478,7 @@ public class SubAnt * references necessary to run the sub-build. */ private Ant createAntTask(File directory) { - Ant antTask = (Ant) getProject().createTask("ant"); - antTask.setOwningTarget(getOwningTarget()); - antTask.setTaskName(getTaskName()); + Ant antTask = new Ant(this); antTask.init(); if (subTarget != null && subTarget.length() > 0) { antTask.setTarget(subTarget); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java b/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java index ab00d4f81..534acb982 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java @@ -122,11 +122,7 @@ public class Cab extends MatchingTask { * it appears in the logs to be the same task as this one. */ protected ExecTask createExec() throws BuildException { - ExecTask exec = (ExecTask) getProject().createTask("exec"); - exec.setOwningTarget(this.getOwningTarget()); - exec.setTaskName(this.getTaskName()); - exec.setDescription(this.getDescription()); - + ExecTask exec = new ExecTask(this); return exec; } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java b/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java index ec7a190c1..f823d0c44 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java @@ -1,5 +1,5 @@ /* - * Copyright 2001-2004 The Apache Software Foundation + * Copyright 2001-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -522,7 +522,8 @@ public class IContract extends MatchingTask { // Prepare the directories for iContract. iContract will make // them if they don't exist, but for some reason I don't know, // it will complain about the REP files afterwards - Mkdir mkdir = (Mkdir) getProject().createTask("mkdir"); + Mkdir mkdir = new Mkdir(); + mkdir.bindToOwner(this); mkdir.setDir(instrumentDir); mkdir.execute(); @@ -590,9 +591,7 @@ public class IContract extends MatchingTask { buildDir.getAbsolutePath())); // Create a forked java process - Java iContract = (Java) getProject().createTask("java"); - - iContract.setTaskName(getTaskName()); + Java iContract = new Java(this); iContract.setFork(true); iContract.setClassname("com.reliablesystems.iContract.Tool"); iContract.setClasspath(iContractClasspath); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java b/src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java index cf5794989..bf3afd3b8 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java @@ -1,5 +1,5 @@ /* - * Copyright 2000,2002,2004 The Apache Software Foundation + * Copyright 2000,2002,2004-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -121,7 +121,8 @@ public class RenameExtensions extends MatchingTask { log("using the same patterns on as you\'ve used here", Project.MSG_INFO); - Move move = (Move) getProject().createTask("move"); + Move move = new Move(); + move.bindToOwner(this); move.setOwningTarget(getOwningTarget()); move.setTaskName(getTaskName()); move.setLocation(getLocation()); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java index 1fcac74e0..68d97fcdf 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2004 The Apache Software Foundation + * Copyright 2000-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -144,17 +144,15 @@ public abstract class ClearCase extends Task { */ protected String runS(Commandline cmdline) { String outV = "opts.cc.runS.output" + pcnt++; - Project aProj = getProject(); - ExecTask exe = (ExecTask) aProj.createTask("exec"); + ExecTask exe = new ExecTask(this); Commandline.Argument arg = exe.createArg(); exe.setExecutable(cmdline.getExecutable()); arg.setLine(Commandline.toString(cmdline.getArguments())); exe.setOutputproperty(outV); exe.execute(); - // System.out.println( "runS: " + outV + " : " + aProj.getProperty( outV )); - return aProj.getProperty(outV); + return getProject().getProperty(outV); } /** * If true, command will throw an exception on failure. diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java index 42696c1ee..71d6719d4 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java @@ -1,5 +1,5 @@ /* - * Copyright 2001-2004 The Apache Software Foundation + * Copyright 2001-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -281,8 +281,8 @@ public class BorlandDeploymentTool extends GenericDeploymentTool private void verifyBorlandJarV5(File sourceJar) { log("verify BES " + sourceJar, Project.MSG_INFO); try { - org.apache.tools.ant.taskdefs.ExecTask execTask = null; - execTask = (ExecTask) getTask().getProject().createTask("exec"); + ExecTask execTask = null; + execTask = new ExecTask(getTask()); execTask.setDir(new File(".")); execTask.setExecutable("iastool"); //classpath @@ -319,7 +319,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool String args = verifyArgs; args += " " + sourceJar.getPath(); - javaTask = (Java) getTask().getProject().createTask("java"); + javaTask = new Java(getTask()); javaTask.setTaskName("verify"); javaTask.setClassname(VERIFY); Commandline.Argument arguments = javaTask.createArg(); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java index bd577f3ae..143d46b60 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2001-2004 The Apache Software Foundation + * Copyright 2001-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -170,8 +170,8 @@ public class BorlandGenerateClient extends Task { log("mode : java"); - org.apache.tools.ant.taskdefs.Java execTask = null; - execTask = (Java) getProject().createTask("java"); + Java execTask = null; + execTask = new Java(this); execTask.setDir(new File(".")); execTask.setClassname("com.inprise.server.commandline.EJBUtilities"); @@ -221,8 +221,7 @@ public class BorlandGenerateClient extends Task { log("mode : fork " + BorlandDeploymentTool.BAS, Project.MSG_DEBUG); - org.apache.tools.ant.taskdefs.ExecTask execTask = null; - execTask = (ExecTask) getProject().createTask("exec"); + ExecTask execTask = new ExecTask(this); execTask.setDir(new File(".")); execTask.setExecutable("iastool"); @@ -254,8 +253,7 @@ public class BorlandGenerateClient extends Task { protected void executeForkV5() throws BuildException { try { log("mode : fork " + BorlandDeploymentTool.BES, Project.MSG_DEBUG); - org.apache.tools.ant.taskdefs.ExecTask execTask = null; - execTask = (ExecTask) getProject().createTask("exec"); + ExecTask execTask = new ExecTask(this); execTask.setDir(new File(".")); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java index 13042dbf7..1c2f28388 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2004 The Apache Software Foundation + * Copyright 2000-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ package org.apache.tools.ant.taskdefs.optional.ejb; import java.io.File; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DirectoryScanner; +import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.types.Commandline; @@ -86,9 +87,8 @@ public class DDCreator extends MatchingTask { } String systemClassPath = System.getProperty("java.class.path"); - String execClassPath = getProject().translatePath(systemClassPath + ":" + classpath); - Java ddCreatorTask = (Java) getProject().createTask("java"); - ddCreatorTask.setTaskName(getTaskName()); + String execClassPath = Project.translatePath(systemClassPath + ":" + classpath); + Java ddCreatorTask = new Java(this); ddCreatorTask.setFork(true); ddCreatorTask.setClassname("org.apache.tools.ant.taskdefs.optional.ejb.DDCreatorHelper"); Commandline.Argument arguments = ddCreatorTask.createArg(); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java index ab5f368be..62b8e8628 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java @@ -1,5 +1,5 @@ /* - * Copyright 2000,2002,2004 The Apache Software Foundation + * Copyright 2000,2002,2004-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ package org.apache.tools.ant.taskdefs.optional.ejb; import java.io.File; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DirectoryScanner; +import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.types.Commandline; @@ -93,15 +94,14 @@ public class Ejbc extends MatchingTask { String systemClassPath = System.getProperty("java.class.path"); String execClassPath - = getProject().translatePath(systemClassPath + ":" + classpath + = Project.translatePath(systemClassPath + ":" + classpath + ":" + generatedFilesDirectory); // get all the files in the descriptor directory DirectoryScanner ds = super.getDirectoryScanner(descriptorDirectory); String[] files = ds.getIncludedFiles(); - Java helperTask = (Java) getProject().createTask("java"); - helperTask.setTaskName(getTaskName()); + Java helperTask = new Java(this); helperTask.setFork(true); helperTask.setClassname("org.apache.tools.ant.taskdefs.optional.ejb.EjbcHelper"); String args = ""; diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java index f9dee6936..675fff7f7 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JonasDeploymentTool.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2004 The Apache Software Foundation + * Copyright 2002-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -520,7 +520,7 @@ public class JonasDeploymentTool extends GenericDeploymentTool { return; } - genicTask = (Java) getTask().getProject().createTask("java"); + genicTask = new Java(getTask()); genicTask.setTaskName("genic"); genicTask.setFork(true); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLRun.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLRun.java index 424a88d40..00cb2bc93 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLRun.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLRun.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2002,2004 The Apache Software Foundation + * Copyright 2000-2002,2004-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -192,7 +192,7 @@ public class WLRun extends Task { + "to start the server"); } - Java weblogicServer = (Java) getProject().createTask("java"); + Java weblogicServer = new Java(this); weblogicServer.setTaskName(getTaskName()); weblogicServer.setFork(true); weblogicServer.setDir(weblogicSystemHome); @@ -247,8 +247,7 @@ public class WLRun extends Task { } } - Java weblogicServer = (Java) getProject().createTask("java"); - weblogicServer.setTaskName(getTaskName()); + Java weblogicServer = new Java(this); weblogicServer.setFork(true); weblogicServer.setClassname(weblogicMainClass); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLStop.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLStop.java index 8b53b7edf..2b3bd7737 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLStop.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLStop.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2002,2004 The Apache Software Foundation + * Copyright 2000-2002,2004-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,7 +78,7 @@ public class WLStop extends Task { throw new BuildException("The url of the weblogic server must be provided."); } - Java weblogicAdmin = (Java) getProject().createTask("java"); + Java weblogicAdmin = new Java(this); weblogicAdmin.setFork(true); weblogicAdmin.setClassname("weblogic.Admin"); String args; diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java index f459b6ebb..0a1e17792 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java @@ -511,7 +511,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { String ejbcClassName = ejbcClass; try { - javaTask = (Java) getTask().getProject().createTask("java"); + javaTask = new Java(getTask()); javaTask.setTaskName("ejbc"); javaTask.createJvmarg().setLine(additionalJvmArgs); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java index 728493bd3..d9f7ebc8f 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WebsphereDeploymentTool.java @@ -541,7 +541,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool { private void buildWebsphereJar(File sourceJar, File destJar) { try { if (ejbdeploy) { - Java javaTask = (Java) getTask().getProject().createTask("java"); + Java javaTask = new Java(getTask()); // Set the JvmArgs javaTask.createJvmarg().setValue("-Xms64m"); javaTask.createJvmarg().setValue("-Xmx128m"); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/AntResolver.java b/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/AntResolver.java index ee39b5ee9..f05f47e83 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/AntResolver.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/AntResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2004 The Apache Software Foundation + * Copyright 2002-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,7 +69,8 @@ public class AntResolver implements ExtensionResolver { final Project project) throws BuildException { validate(); - final Ant ant = (Ant) project.createTask("ant"); + final Ant ant = new Ant(); + ant.setProject(project); ant.setInheritAll(false); ant.setAntfile(antfile.getName()); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/URLResolver.java b/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/URLResolver.java index fa22d336e..a16668e13 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/URLResolver.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/URLResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002,2004 The Apache Software Foundation + * Copyright 2002,2004-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -71,7 +71,8 @@ public class URLResolver implements ExtensionResolver { final File file = getDest(); - final Get get = (Get) project.createTask("get"); + final Get get = new Get(); + get.setProject(project); get.setDest(file); get.setSrc(url); get.execute(); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/GenericHotDeploymentTool.java b/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/GenericHotDeploymentTool.java index 724bfe43b..d80037429 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/GenericHotDeploymentTool.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/GenericHotDeploymentTool.java @@ -1,5 +1,5 @@ /* - * Copyright 2002,2004 The Apache Software Foundation + * Copyright 2002,2004-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -80,7 +80,7 @@ public class GenericHotDeploymentTool extends AbstractHotDeploymentTool { */ public void setTask(ServerDeploy task) { super.setTask(task); - java = (Java) task.getProject().createTask("java"); + java = new Java(task); } /** diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/WebLogicHotDeploymentTool.java b/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/WebLogicHotDeploymentTool.java index 20983f717..8a2e02a3c 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/WebLogicHotDeploymentTool.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/j2ee/WebLogicHotDeploymentTool.java @@ -1,5 +1,5 @@ /* - * Copyright 2002,2004 The Apache Software Foundation + * Copyright 2002,2004-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,7 +58,7 @@ public class WebLogicHotDeploymentTool extends AbstractHotDeploymentTool * @exception org.apache.tools.ant.BuildException if the attributes are invalid or incomplete. */ public void deploy() { - Java java = (Java) getTask().getProject().createTask("java"); + Java java = new Java(getTask()); java.setFork(true); java.setFailonerror(true); java.setClasspath(getClasspath()); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java b/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java index e094939a9..85e432629 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java @@ -1,5 +1,5 @@ /* - * Copyright 2000,2002-2004 The Apache Software Foundation + * Copyright 2000,2002-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -132,7 +132,7 @@ public class WLJspc extends MatchingTask { // Therefore, takes loads of time // Can pass directories at a time (*.jsp) but easily runs out of // memory on hefty dirs (even on a Sun) - Java helperTask = (Java) getProject().createTask("java"); + Java helperTask = new Java(this); helperTask.setFork(true); helperTask.setClassname("weblogic.jspc"); helperTask.setTaskName(getTaskName()); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java b/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java index fa082260a..50df8c281 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java @@ -1,5 +1,5 @@ /* - * Copyright 2001-2004 The Apache Software Foundation + * Copyright 2001-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,7 +56,7 @@ public class JasperC extends DefaultJspCompilerAdapter { try { // Create an instance of the compiler, redirecting output to // the project log - Java java = (Java) (getProject().createTask("java")); + Java java = new Java(owner); Path p = getClasspath(); if (getJspc().getClasspath() != null) { getProject().log("using user supplied classpath: " + p, diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java index 297a43bf7..0db993491 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java @@ -1504,7 +1504,8 @@ public class FTP } // delegate the deletion of the local temp file to the delete task // because of race conditions occuring on Windows - Delete mydelete = (Delete) getProject().createTask("delete"); + Delete mydelete = new Delete(); + mydelete.bindToOwner(this); mydelete.setFile(tempFile.getCanonicalFile()); mydelete.execute(); } catch (Exception e) {