Browse Source

Encapsulate usage of project object rather than allowing objects 7 subclasses acessing a protected variable of their super super super .... class.

Deprecated the variable so that that anyone directly referencing variable will get warning and suggestion to use the accessor.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273155 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
28b68ab7d0
100 changed files with 409 additions and 474 deletions
  1. +7
    -3
      src/main/org/apache/tools/ant/ProjectComponent.java
  2. +52
    -52
      src/main/org/apache/tools/ant/Task.java
  3. +1
    -1
      src/main/org/apache/tools/ant/TaskAdapter.java
  4. +4
    -4
      src/main/org/apache/tools/ant/UnknownElement.java
  5. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
  6. +10
    -10
      src/main/org/apache/tools/ant/taskdefs/Ant.java
  7. +6
    -10
      src/main/org/apache/tools/ant/taskdefs/AntStructure.java
  8. +8
    -8
      src/main/org/apache/tools/ant/taskdefs/Available.java
  9. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/Checksum.java
  10. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/Chmod.java
  11. +6
    -6
      src/main/org/apache/tools/ant/taskdefs/Concat.java
  12. +6
    -6
      src/main/org/apache/tools/ant/taskdefs/Copy.java
  13. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Copydir.java
  14. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Copyfile.java
  15. +7
    -7
      src/main/org/apache/tools/ant/taskdefs/Definer.java
  16. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Delete.java
  17. +8
    -8
      src/main/org/apache/tools/ant/taskdefs/DependSet.java
  18. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Echo.java
  19. +10
    -15
      src/main/org/apache/tools/ant/taskdefs/Exec.java
  20. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/ExecTask.java
  21. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
  22. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/Exit.java
  23. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/Expand.java
  24. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Filter.java
  25. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/GenerateKey.java
  26. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Input.java
  27. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/JDBCTask.java
  28. +5
    -5
      src/main/org/apache/tools/ant/taskdefs/Java.java
  29. +6
    -6
      src/main/org/apache/tools/ant/taskdefs/Javac.java
  30. +7
    -7
      src/main/org/apache/tools/ant/taskdefs/Javadoc.java
  31. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/LoadFile.java
  32. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/LoadProperties.java
  33. +1
    -2
      src/main/org/apache/tools/ant/taskdefs/MatchingTask.java
  34. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/Move.java
  35. +6
    -6
      src/main/org/apache/tools/ant/taskdefs/Property.java
  36. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/Rmic.java
  37. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/SQLExec.java
  38. +3
    -4
      src/main/org/apache/tools/ant/taskdefs/SignJar.java
  39. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/Tar.java
  40. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Taskdef.java
  41. +2
    -6
      src/main/org/apache/tools/ant/taskdefs/TempFile.java
  42. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Touch.java
  43. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/Tstamp.java
  44. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/Typedef.java
  45. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/Unpack.java
  46. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/UpToDate.java
  47. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/WaitFor.java
  48. +6
    -6
      src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
  49. +2
    -5
      src/main/org/apache/tools/ant/taskdefs/XmlProperty.java
  50. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/Zip.java
  51. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java
  52. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java
  53. +3
    -10
      src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java
  54. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/Cab.java
  55. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
  56. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/IContract.java
  57. +3
    -5
      src/main/org/apache/tools/ant/taskdefs/optional/Javah.java
  58. +2
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java
  59. +35
    -39
      src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
  60. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java
  61. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java
  62. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java
  63. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/Script.java
  64. +6
    -9
      src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java
  65. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java
  66. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java
  67. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java
  68. +3
    -11
      src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java
  69. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java
  70. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java
  71. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java
  72. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java
  73. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java
  74. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbcTask.java
  75. +6
    -6
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLRun.java
  76. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLStop.java
  77. +1
    -7
      src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java
  78. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJImport.java
  79. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java
  80. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java
  81. +3
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java
  82. +4
    -12
      src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java
  83. +5
    -8
      src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java
  84. +12
    -12
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  85. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java
  86. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java
  87. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java
  88. +5
    -5
      src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java
  89. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  90. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java
  91. +4
    -12
      src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java
  92. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java
  93. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java
  94. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java
  95. +6
    -6
      src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java
  96. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java
  97. +5
    -5
      src/main/org/apache/tools/ant/taskdefs/optional/sos/SOS.java
  98. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java
  99. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java
  100. +3
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java

+ 7
- 3
src/main/org/apache/tools/ant/ProjectComponent.java View File

@@ -60,11 +60,15 @@ package org.apache.tools.ant;
* *
* @author Conor MacNeill * @author Conor MacNeill
*/ */

public abstract class ProjectComponent { public abstract class ProjectComponent {


/** Project object of this component. */
protected Project project = null;
/**
* Project object of this component.
* @deprecated You should not be directly accessing this variable
* directly. You should access project object via the getProject()
* or setProject() accessor/mutators.
*/
protected Project project;


/** Sole constructor. */ /** Sole constructor. */
public ProjectComponent() { public ProjectComponent() {


+ 52
- 52
src/main/org/apache/tools/ant/Task.java View File

@@ -61,7 +61,7 @@ import java.util.Enumeration;
* *
* Use Project.createTask to create a new task instance rather than * Use Project.createTask to create a new task instance rather than
* using this class directly for construction. * using this class directly for construction.
*
*
* @see Project#createTask * @see Project#createTask
*/ */
public abstract class Task extends ProjectComponent { public abstract class Task extends ProjectComponent {
@@ -71,8 +71,8 @@ public abstract class Task extends ProjectComponent {
protected String description = null; protected String description = null;
/** Location within the build file of this task definition. */ /** Location within the build file of this task definition. */
protected Location location = Location.UNKNOWN_LOCATION; protected Location location = Location.UNKNOWN_LOCATION;
/**
* Name of this task to be used for logging purposes.
/**
* Name of this task to be used for logging purposes.
* This defaults to the same as the type, but may be * This defaults to the same as the type, but may be
* overridden by the user. For instance, the name "java" * overridden by the user. For instance, the name "java"
* isn't terribly descriptive for a task used within * isn't terribly descriptive for a task used within
@@ -84,7 +84,7 @@ public abstract class Task extends ProjectComponent {
protected String taskType = null; protected String taskType = null;
/** Wrapper for this object, used to configure it at runtime. */ /** Wrapper for this object, used to configure it at runtime. */
protected RuntimeConfigurable wrapper; protected RuntimeConfigurable wrapper;
/**
/**
* Whether or not this task is invalid. A task becomes invalid * Whether or not this task is invalid. A task becomes invalid
* if a conflicting class is specified as the implementation for * if a conflicting class is specified as the implementation for
* its type. * its type.
@@ -114,7 +114,7 @@ public abstract class Task extends ProjectComponent {
public Target getOwningTarget() { public Target getOwningTarget() {
return target; return target;
} }
/** /**
* Sets the name to use in logging messages. * Sets the name to use in logging messages.
* *
@@ -128,7 +128,7 @@ public abstract class Task extends ProjectComponent {
/** /**
* Returns the name to use in logging messages. * Returns the name to use in logging messages.
* *
* @return the name to use in logging messages.
* @return the name to use in logging messages.
*/ */
public String getTaskName() { public String getTaskName() {
return taskName; return taskName;
@@ -144,14 +144,14 @@ public abstract class Task extends ProjectComponent {
this.taskType = type; this.taskType = type;
} }


/**
/**
* Sets a description of the current action. This may be used for logging * Sets a description of the current action. This may be used for logging
* purposes. * purposes.
*
* @param desc Description of the current action.
*
* @param desc Description of the current action.
* May be <code>null</code>, indicating that no description is * May be <code>null</code>, indicating that no description is
* available. * available.
*
*
*/ */
public void setDescription(String desc) { public void setDescription(String desc) {
description = desc; description = desc;
@@ -159,7 +159,7 @@ public abstract class Task extends ProjectComponent {


/** /**
* Returns the description of the current action. * Returns the description of the current action.
*
*
* @return the description of the current action, or <code>null</code> if * @return the description of the current action, or <code>null</code> if
* no description is available. * no description is available.
*/ */
@@ -176,10 +176,10 @@ public abstract class Task extends ProjectComponent {
public void init() throws BuildException {} public void init() throws BuildException {}


/** /**
* Called by the project to let the task do its work. This method may be
* called more than once, if the task is invoked more than once.
* For example,
* if target1 and target2 both depend on target3, then running
* Called by the project to let the task do its work. This method may be
* called more than once, if the task is invoked more than once.
* For example,
* if target1 and target2 both depend on target3, then running
* "ant target1 target2" will run all tasks in target3 twice. * "ant target1 target2" will run all tasks in target3 twice.
* *
* @exception BuildException if something goes wrong with the build * @exception BuildException if something goes wrong with the build
@@ -188,11 +188,11 @@ public abstract class Task extends ProjectComponent {


/** /**
* Returns the file/location where this task was defined. * Returns the file/location where this task was defined.
*
* @return the file/location where this task was defined.
*
* @return the file/location where this task was defined.
* Should not return <code>null</code>. Location.UNKNOWN_LOCATION * Should not return <code>null</code>. Location.UNKNOWN_LOCATION
* is used for unknown locations. * is used for unknown locations.
*
*
* @see Location#UNKNOWN_LOCATION * @see Location#UNKNOWN_LOCATION
*/ */
public Location getLocation() { public Location getLocation() {
@@ -201,11 +201,11 @@ public abstract class Task extends ProjectComponent {


/** /**
* Sets the file/location where this task was defined. * Sets the file/location where this task was defined.
*
*
* @param location The file/location where this task was defined. * @param location The file/location where this task was defined.
* Should not be <code>null</code> - use * Should not be <code>null</code> - use
* Location.UNKNOWN_LOCATION if the location isn't known. * Location.UNKNOWN_LOCATION if the location isn't known.
*
*
* @see Location#UNKNOWN_LOCATION * @see Location#UNKNOWN_LOCATION
*/ */
public void setLocation(Location location) { public void setLocation(Location location) {
@@ -214,7 +214,7 @@ public abstract class Task extends ProjectComponent {


/** /**
* Returns the wrapper used for runtime configuration. * Returns the wrapper used for runtime configuration.
*
*
* @return the wrapper used for runtime configuration. This * @return the wrapper used for runtime configuration. This
* method will generate a new wrapper (and cache it) * method will generate a new wrapper (and cache it)
* if one isn't set already. * if one isn't set already.
@@ -232,7 +232,7 @@ public abstract class Task extends ProjectComponent {
* This method should be used only by the ProjectHelper and ant internals. * This method should be used only by the ProjectHelper and ant internals.
* It is public to allow helper plugins to operate on tasks, normal tasks * It is public to allow helper plugins to operate on tasks, normal tasks
* should never use it. * should never use it.
*
*
* @param wrapper The wrapper to be used for runtime configuration. * @param wrapper The wrapper to be used for runtime configuration.
* May be <code>null</code>, in which case the next call * May be <code>null</code>, in which case the next call
* to getRuntimeConfigurableWrapper will generate a new * to getRuntimeConfigurableWrapper will generate a new
@@ -248,7 +248,7 @@ public abstract class Task extends ProjectComponent {
// unless I've missed something. // unless I've missed something.
/** /**
* Configures this task - if it hasn't been done already. * Configures this task - if it hasn't been done already.
* If the task has been invalidated, it is replaced with an
* If the task has been invalidated, it is replaced with an
* UnknownElement task which uses the new definition in the project. * UnknownElement task which uses the new definition in the project.
* *
* @exception BuildException if the task cannot be configured. * @exception BuildException if the task cannot be configured.
@@ -256,56 +256,56 @@ public abstract class Task extends ProjectComponent {
public void maybeConfigure() throws BuildException { public void maybeConfigure() throws BuildException {
if (!invalid) { if (!invalid) {
if (wrapper != null) { if (wrapper != null) {
wrapper.maybeConfigure(project);
wrapper.maybeConfigure(getProject());
} }
} else { } else {
getReplacement(); getReplacement();
} }
} }


/**
/**
* Handles a line of output by logging it with the INFO priority. * Handles a line of output by logging it with the INFO priority.
*
*
* @param line The line of output to log. Should not be <code>null</code>. * @param line The line of output to log. Should not be <code>null</code>.
*/ */
protected void handleOutput(String line) { protected void handleOutput(String line) {
log(line, Project.MSG_INFO); log(line, Project.MSG_INFO);
} }
/**
/**
* Handles an error line by logging it with the INFO priority. * Handles an error line by logging it with the INFO priority.
*
*
* @param line The error line to log. Should not be <code>null</code>. * @param line The error line to log. Should not be <code>null</code>.
*/ */
protected void handleErrorOutput(String line) { protected void handleErrorOutput(String line) {
log(line, Project.MSG_ERR); log(line, Project.MSG_ERR);
} }
/**
* Logs a message with the default (INFO) priority.
*
/**
* Logs a message with the default (INFO) priority.
*
* @param msg The message to be logged. Should not be <code>null</code>. * @param msg The message to be logged. Should not be <code>null</code>.
*/
public void log(String msg) {
log(msg, Project.MSG_INFO);
}
/**
*/
public void log(String msg) {
log(msg, Project.MSG_INFO);
}
/**
* Logs a mesage with the given priority. This delegates * Logs a mesage with the given priority. This delegates
* the actual logging to the project. * the actual logging to the project.
*
*
* @param msg The message to be logged. Should not be <code>null</code>. * @param msg The message to be logged. Should not be <code>null</code>.
* @param msgLevel The message priority at which this message is to
* @param msgLevel The message priority at which this message is to
* be logged. * be logged.
*/
public void log(String msg, int msgLevel) {
project.log(this, msg, msgLevel);
}
*/
public void log(String msg, int msgLevel) {
getProject().log(this, msg, msgLevel);
}
/** /**
* Performs this task if it's still valid, or gets a replacement * Performs this task if it's still valid, or gets a replacement
* version and performs that otherwise. * version and performs that otherwise.
*
*
* Performing a task consists of firing a task started event, * Performing a task consists of firing a task started event,
* configuring the task, executing it, and then firing task finished * configuring the task, executing it, and then firing task finished
* event. If a runtime exception is thrown, the task finished event * event. If a runtime exception is thrown, the task finished event
@@ -314,10 +314,10 @@ public abstract class Task extends ProjectComponent {
public final void perform() { public final void perform() {
if (!invalid) { if (!invalid) {
try { try {
project.fireTaskStarted(this);
getProject().fireTaskStarted(this);
maybeConfigure(); maybeConfigure();
execute(); execute();
project.fireTaskFinished(this, null);
getProject().fireTaskFinished(this, null);
} catch (RuntimeException exc) { } catch (RuntimeException exc) {
if (exc instanceof BuildException) { if (exc instanceof BuildException) {
BuildException be = (BuildException) exc; BuildException be = (BuildException) exc;
@@ -325,7 +325,7 @@ public abstract class Task extends ProjectComponent {
be.setLocation(getLocation()); be.setLocation(getLocation());
} }
} }
project.fireTaskFinished(this, exc);
getProject().fireTaskFinished(this, exc);
throw exc; throw exc;
} }
} else { } else {
@@ -367,7 +367,7 @@ public abstract class Task extends ProjectComponent {
private UnknownElement getReplacement() { private UnknownElement getReplacement() {
if (replacement == null) { if (replacement == null) {
replacement = new UnknownElement(taskType); replacement = new UnknownElement(taskType);
replacement.setProject(project);
replacement.setProject(getProject());
replacement.setTaskType(taskType); replacement.setTaskType(taskType);
replacement.setTaskName(taskName); replacement.setTaskName(taskName);
replacement.setLocation(location); replacement.setLocation(location);
@@ -393,7 +393,7 @@ public abstract class Task extends ProjectComponent {
while (enum.hasMoreElements()) { while (enum.hasMoreElements()) {
RuntimeConfigurable childWrapper = RuntimeConfigurable childWrapper =
(RuntimeConfigurable) enum.nextElement(); (RuntimeConfigurable) enum.nextElement();
UnknownElement childElement =
UnknownElement childElement =
new UnknownElement(childWrapper.getElementTag()); new UnknownElement(childWrapper.getElementTag());
parentElement.addChild(childElement); parentElement.addChild(childElement);
childElement.setRuntimeConfigurableWrapper(childWrapper); childElement.setRuntimeConfigurableWrapper(childWrapper);


+ 1
- 1
src/main/org/apache/tools/ant/TaskAdapter.java View File

@@ -122,7 +122,7 @@ public class TaskAdapter extends Task {
setProjectM = setProjectM =
c.getMethod("setProject", new Class[] {Project.class}); c.getMethod("setProject", new Class[] {Project.class});
if (setProjectM != null) { if (setProjectM != null) {
setProjectM.invoke(proxy, new Object[] {project});
setProjectM.invoke(proxy, new Object[] {getProject()});
} }
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
// ignore this if the class being used as a task does not have // ignore this if the class being used as a task does not have


+ 4
- 4
src/main/org/apache/tools/ant/UnknownElement.java View File

@@ -121,7 +121,7 @@ public class UnknownElement extends Task {


handleChildren(realThing, wrapper); handleChildren(realThing, wrapper);


wrapper.maybeConfigure(project);
wrapper.maybeConfigure(getProject());
} }


/** /**
@@ -209,7 +209,7 @@ public class UnknownElement extends Task {
realChild = makeTask(child, childWrapper, false); realChild = makeTask(child, childWrapper, false);
((TaskContainer) parent).addTask((Task) realChild); ((TaskContainer) parent).addTask((Task) realChild);
} else { } else {
realChild = ih.createElement(project, parent, child.getTag());
realChild = ih.createElement(getProject(), parent, child.getTag());
} }


childWrapper.setProxy(realChild); childWrapper.setProxy(realChild);
@@ -238,7 +238,7 @@ public class UnknownElement extends Task {
protected Object makeObject(UnknownElement ue, RuntimeConfigurable w) { protected Object makeObject(UnknownElement ue, RuntimeConfigurable w) {
Object o = makeTask(ue, w, true); Object o = makeTask(ue, w, true);
if (o == null) { if (o == null) {
o = project.createDataType(ue.getTag());
o = getProject().createDataType(ue.getTag());
} }
if (o == null) { if (o == null) {
throw getNotFoundException("task or type", ue.getTag()); throw getNotFoundException("task or type", ue.getTag());
@@ -263,7 +263,7 @@ public class UnknownElement extends Task {
*/ */
protected Task makeTask(UnknownElement ue, RuntimeConfigurable w, protected Task makeTask(UnknownElement ue, RuntimeConfigurable w,
boolean onTopLevel) { boolean onTopLevel) {
Task task = project.createTask(ue.getTag());
Task task = getProject().createTask(ue.getTag());
if (task == null && !onTopLevel) { if (task == null && !onTopLevel) {
throw getNotFoundException("task", ue.getTag()); throw getNotFoundException("task", ue.getTag());
} }


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java View File

@@ -309,9 +309,9 @@ public abstract class AbstractCvsTask extends Task {
// //
Execute exe = new Execute(getExecuteStreamHandler(), null); Execute exe = new Execute(getExecuteStreamHandler(), null);


exe.setAntRun(project);
exe.setAntRun(getProject());
if (dest == null) { if (dest == null) {
dest = project.getBaseDir();
dest = getProject().getBaseDir();
} }


if (!dest.exists()) { if (!dest.exists()) {


+ 10
- 10
src/main/org/apache/tools/ant/taskdefs/Ant.java View File

@@ -152,7 +152,7 @@ public class Ant extends Task {
newProject = new Project(); newProject = new Project();
newProject.setJavaVersionProperty(); newProject.setJavaVersionProperty();
newProject.addTaskDefinition("property", newProject.addTaskDefinition("property",
(Class) project.getTaskDefinitions()
(Class) getProject().getTaskDefinitions()
.get("property")); .get("property"));
} }


@@ -208,7 +208,7 @@ public class Ant extends Task {
private void initializeProject() { private void initializeProject() {
newProject.setInputHandler(getProject().getInputHandler()); newProject.setInputHandler(getProject().getInputHandler());


Vector listeners = project.getBuildListeners();
Vector listeners = getProject().getBuildListeners();
final int count = listeners.size(); final int count = listeners.size();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
newProject.addBuildListener((BuildListener) listeners.elementAt(i)); newProject.addBuildListener((BuildListener) listeners.elementAt(i));
@@ -233,7 +233,7 @@ public class Ant extends Task {
} }
} }


Hashtable taskdefs = project.getTaskDefinitions();
Hashtable taskdefs = getProject().getTaskDefinitions();
Enumeration et = taskdefs.keys(); Enumeration et = taskdefs.keys();
while (et.hasMoreElements()) { while (et.hasMoreElements()) {
String taskName = (String) et.nextElement(); String taskName = (String) et.nextElement();
@@ -245,7 +245,7 @@ public class Ant extends Task {
newProject.addTaskDefinition(taskName, taskClass); newProject.addTaskDefinition(taskName, taskClass);
} }


Hashtable typedefs = project.getDataTypeDefinitions();
Hashtable typedefs = getProject().getDataTypeDefinitions();
Enumeration e = typedefs.keys(); Enumeration e = typedefs.keys();
while (e.hasMoreElements()) { while (e.hasMoreElements()) {
String typeName = (String) e.nextElement(); String typeName = (String) e.nextElement();
@@ -322,7 +322,7 @@ public class Ant extends Task {
} }


if ((dir == null) && (inheritAll)) { if ((dir == null) && (inheritAll)) {
dir = project.getBaseDir();
dir = getProject().getBaseDir();
} }


initializeProject(); initializeProject();
@@ -334,7 +334,7 @@ public class Ant extends Task {
dir.getAbsolutePath()); dir.getAbsolutePath());
} }
} else { } else {
dir = project.getBaseDir();
dir = getProject().getBaseDir();
} }


overrideProperties(); overrideProperties();
@@ -358,8 +358,8 @@ public class Ant extends Task {


// Are we trying to call the target in which we are defined (or // Are we trying to call the target in which we are defined (or
// the build file if this is a top level task)? // the build file if this is a top level task)?
if (newProject.getBaseDir().equals(project.getBaseDir()) &&
newProject.getProperty("ant.file").equals(project.getProperty("ant.file"))
if (newProject.getBaseDir().equals(getProject().getBaseDir()) &&
newProject.getProperty("ant.file").equals(getProject().getProperty("ant.file"))
&& getOwningTarget() != null && getOwningTarget() != null
&& (getOwningTarget().getName().equals("") || && (getOwningTarget().getName().equals("") ||
getOwningTarget().getName().equals(target))) { getOwningTarget().getName().equals(target))) {
@@ -411,7 +411,7 @@ public class Ant extends Task {
* requested. * requested.
*/ */
private void addReferences() throws BuildException { private void addReferences() throws BuildException {
Hashtable thisReferences = (Hashtable) project.getReferences().clone();
Hashtable thisReferences = (Hashtable) getProject().getReferences().clone();
Hashtable newReferences = newProject.getReferences(); Hashtable newReferences = newProject.getReferences();
Enumeration e; Enumeration e;
if (references.size() > 0) { if (references.size() > 0) {
@@ -460,7 +460,7 @@ public class Ant extends Task {
* keep our fingers crossed.</p> * keep our fingers crossed.</p>
*/ */
private void copyReference(String oldKey, String newKey) { private void copyReference(String oldKey, String newKey) {
Object orig = project.getReference(oldKey);
Object orig = getProject().getReference(oldKey);
Class c = orig.getClass(); Class c = orig.getClass();
Object copy = orig; Object copy = orig;
try { try {


+ 6
- 10
src/main/org/apache/tools/ant/taskdefs/AntStructure.java View File

@@ -127,27 +127,25 @@ public class AntStructure extends Task {
out = new PrintWriter(new FileWriter(output)); out = new PrintWriter(new FileWriter(output));
} }


printHead(out, project.getTaskDefinitions().keys(),
project.getDataTypeDefinitions().keys());
printHead(out, getProject().getTaskDefinitions().keys(),
getProject().getDataTypeDefinitions().keys());


printTargetDecl(out); printTargetDecl(out);


Enumeration dataTypes = project.getDataTypeDefinitions().keys();
Enumeration dataTypes = getProject().getDataTypeDefinitions().keys();
while (dataTypes.hasMoreElements()) { while (dataTypes.hasMoreElements()) {
String typeName = (String) dataTypes.nextElement(); String typeName = (String) dataTypes.nextElement();
printElementDecl(out, typeName, printElementDecl(out, typeName,
(Class) project.getDataTypeDefinitions().get(typeName));
(Class) getProject().getDataTypeDefinitions().get(typeName));
} }


Enumeration tasks = project.getTaskDefinitions().keys();
Enumeration tasks = getProject().getTaskDefinitions().keys();
while (tasks.hasMoreElements()) { while (tasks.hasMoreElements()) {
String taskName = (String) tasks.nextElement(); String taskName = (String) tasks.nextElement();
printElementDecl(out, taskName, printElementDecl(out, taskName,
(Class) project.getTaskDefinitions().get(taskName));
(Class) getProject().getTaskDefinitions().get(taskName));
} }


printTail(out);

} catch (IOException ioe) { } catch (IOException ioe) {
throw new BuildException("Error writing " throw new BuildException("Error writing "
+ output.getAbsolutePath(), ioe, location); + output.getAbsolutePath(), ioe, location);
@@ -359,8 +357,6 @@ public class AntStructure extends Task {
} }
} }


private void printTail(PrintWriter out) {}

/** /**
* Does this String match the XML-NMTOKEN production? * Does this String match the XML-NMTOKEN production?
*/ */


+ 8
- 8
src/main/org/apache/tools/ant/taskdefs/Available.java View File

@@ -109,7 +109,7 @@ public class Available extends Task implements Condition {
*/ */
public Path createClasspath() { public Path createClasspath() {
if (this.classpath == null) { if (this.classpath == null) {
this.classpath = new Path(project);
this.classpath = new Path(getProject());
} }
return this.classpath.createPath(); return this.classpath.createPath();
} }
@@ -141,7 +141,7 @@ public class Available extends Task implements Condition {
*/ */
public Path createFilepath() { public Path createFilepath() {
if (this.filepath == null) { if (this.filepath == null) {
this.filepath = new Path(project);
this.filepath = new Path(getProject());
} }
return this.filepath.createPath(); return this.filepath.createPath();
} }
@@ -184,9 +184,9 @@ public class Available extends Task implements Condition {
* *
* @param file the name of the file which is required. * @param file the name of the file which is required.
*/ */
public void setFile(File f) {
public void setFile(File file) {
this.file = FileUtils.newFileUtils() this.file = FileUtils.newFileUtils()
.removeLeadingPath(getProject().getBaseDir(), f);
.removeLeadingPath(getProject().getBaseDir(), file);
} }


/** /**
@@ -264,7 +264,7 @@ public class Available extends Task implements Condition {
* Evaluate the availability of a resource. * Evaluate the availability of a resource.
* *
* @return boolean is the resource is available. * @return boolean is the resource is available.
* @exception if the condition is not configured correctly
* @exception BuildException if the condition is not configured correctly
*/ */
public boolean eval() throws BuildException { public boolean eval() throws BuildException {
if (classname == null && file == null && resource == null) { if (classname == null && file == null && resource == null) {
@@ -281,8 +281,8 @@ public class Available extends Task implements Condition {
} }


if (classpath != null) { if (classpath != null) {
classpath.setProject(project);
this.loader = new AntClassLoader(project, classpath);
classpath.setProject(getProject());
this.loader = new AntClassLoader(getProject(), classpath);
} }


String appendix = ""; String appendix = "";
@@ -344,7 +344,7 @@ public class Available extends Task implements Condition {
*/ */
private boolean checkFile() { private boolean checkFile() {
if (filepath == null) { if (filepath == null) {
return checkFile(project.resolveFile(file), file);
return checkFile(getProject().resolveFile(file), file);
} else { } else {
String[] paths = filepath.list(); String[] paths = filepath.list();
for (int i = 0; i < paths.length; ++i) { for (int i = 0; i < paths.length; ++i) {


+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/Checksum.java View File

@@ -209,7 +209,7 @@ public class Checksum extends MatchingTask implements Condition {
isCondition = false; isCondition = false;
boolean value = validateAndExecute(); boolean value = validateAndExecute();
if (verifyProperty != null) { if (verifyProperty != null) {
project.setNewProperty(verifyProperty,
getProject().setNewProperty(verifyProperty,
new Boolean(value).toString()); new Boolean(value).toString());
} }
} }
@@ -314,10 +314,10 @@ public class Checksum extends MatchingTask implements Condition {
int sizeofFileSet = filesets.size(); int sizeofFileSet = filesets.size();
for (int i = 0; i < sizeofFileSet; i++) { for (int i = 0; i < sizeofFileSet; i++) {
FileSet fs = (FileSet) filesets.elementAt(i); FileSet fs = (FileSet) filesets.elementAt(i);
DirectoryScanner ds = fs.getDirectoryScanner(project);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
String[] srcFiles = ds.getIncludedFiles(); String[] srcFiles = ds.getIncludedFiles();
for (int j = 0; j < srcFiles.length; j++) { for (int j = 0; j < srcFiles.length; j++) {
File src = new File(fs.getDir(project), srcFiles[j]);
File src = new File(fs.getDir(getProject()), srcFiles[j]);
addToIncludeFileMap(src); addToIncludeFileMap(src);
} }
} }
@@ -400,7 +400,7 @@ public class Checksum extends MatchingTask implements Condition {
if (isCondition) { if (isCondition) {
checksumMatches = checksum.equals(property); checksumMatches = checksum.equals(property);
} else { } else {
project.setNewProperty(prop, checksum);
getProject().setNewProperty(prop, checksum);
} }
} else if (destination instanceof java.io.File) { } else if (destination instanceof java.io.File) {
if (isCondition) { if (isCondition) {


+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/Chmod.java View File

@@ -193,7 +193,7 @@ public class Chmod extends ExecuteOn {
location); location);
} }


if (defaultSetDefined && defaultSet.getDir(project) != null) {
if (defaultSetDefined && defaultSet.getDir(getProject()) != null) {
addFileset(defaultSet); addFileset(defaultSet);
} }
super.checkConfiguration(); super.checkConfiguration();
@@ -206,11 +206,11 @@ public class Chmod extends ExecuteOn {
* second branch of the if statement below catches for backwards * second branch of the if statement below catches for backwards
* compatibility. * compatibility.
*/ */
if (defaultSetDefined || defaultSet.getDir(project) == null) {
if (defaultSetDefined || defaultSet.getDir(getProject()) == null) {
try { try {
super.execute(); super.execute();
} finally { } finally {
if (defaultSetDefined && defaultSet.getDir(project) != null) {
if (defaultSetDefined && defaultSet.getDir(getProject()) != null) {
filesets.removeElement(defaultSet); filesets.removeElement(defaultSet);
} }
} }
@@ -218,7 +218,7 @@ public class Chmod extends ExecuteOn {
// we are chmodding the given directory // we are chmodding the given directory
Execute execute = prepareExec(); Execute execute = prepareExec();
Commandline cloned = (Commandline) cmdl.clone(); Commandline cloned = (Commandline) cmdl.clone();
cloned.createArgument().setValue(defaultSet.getDir(project)
cloned.createArgument().setValue(defaultSet.getDir(getProject())
.getPath()); .getPath());
try { try {
execute.setCommandline(cloned.getCommandline()); execute.setCommandline(cloned.getCommandline());


+ 6
- 6
src/main/org/apache/tools/ant/taskdefs/Concat.java View File

@@ -246,10 +246,10 @@ public class Concat extends Task {
// determine the files from the set which need to be // determine the files from the set which need to be
// concatenated. // concatenated.
DirectoryScanner scanner = DirectoryScanner scanner =
fileSet.getDirectoryScanner(project);
fileSet.getDirectoryScanner(getProject());
// Determine the root path. // Determine the root path.
fileSetBase = fileSet.getDir(project);
fileSetBase = fileSet.getDir(getProject());
// Get the list of files. // Get the list of files.
srcFiles = scanner.getIncludedFiles(); srcFiles = scanner.getIncludedFiles();
@@ -259,10 +259,10 @@ public class Concat extends Task {
FileList fileList = (FileList) next; FileList fileList = (FileList) next;
// Determine the root path. // Determine the root path.
fileSetBase = fileList.getDir(project);
fileSetBase = fileList.getDir(getProject());
// Get the list of files. // Get the list of files.
srcFiles = fileList.getFiles(project);
srcFiles = fileList.getFiles(getProject());
} }


@@ -455,8 +455,8 @@ public class Concat extends Task {
String text = textBuffer.toString(); String text = textBuffer.toString();


// Replace ${property} strings. // Replace ${property} strings.
text = ProjectHelper.replaceProperties(project, text,
project.getProperties());
text = ProjectHelper.replaceProperties(getProject(), text,
getProject().getProperties());


// Set up a writer if necessary. // Set up a writer if necessary.
FileWriter writer = null; FileWriter writer = null;


+ 6
- 6
src/main/org/apache/tools/ant/taskdefs/Copy.java View File

@@ -282,7 +282,7 @@ public class Copy extends Task {
throw new BuildException("Cannot define more than one mapper", throw new BuildException("Cannot define more than one mapper",
location); location);
} }
mapperElement = new Mapper(project);
mapperElement = new Mapper(getProject());
return mapperElement; return mapperElement;
} }


@@ -351,8 +351,8 @@ public class Copy extends Task {
// deal with the filesets // deal with the filesets
for (int i = 0; i < filesets.size(); i++) { for (int i = 0; i < filesets.size(); i++) {
FileSet fs = (FileSet) filesets.elementAt(i); FileSet fs = (FileSet) filesets.elementAt(i);
DirectoryScanner ds = fs.getDirectoryScanner(project);
File fromDir = fs.getDir(project);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
File fromDir = fs.getDir(getProject());


String[] srcFiles = ds.getIncludedFiles(); String[] srcFiles = ds.getIncludedFiles();
String[] srcDirs = ds.getIncludedDirectories(); String[] srcDirs = ds.getIncludedDirectories();
@@ -416,7 +416,7 @@ public class Copy extends Task {
"Cannot concatenate multiple files into a single file."); "Cannot concatenate multiple files into a single file.");
} else { } else {
FileSet fs = (FileSet) filesets.elementAt(0); FileSet fs = (FileSet) filesets.elementAt(0);
DirectoryScanner ds = fs.getDirectoryScanner(project);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
String[] srcFiles = ds.getIncludedFiles(); String[] srcFiles = ds.getIncludedFiles();


if (srcFiles.length == 0) { if (srcFiles.length == 0) {
@@ -517,7 +517,7 @@ public class Copy extends Task {
new FilterSetCollection(); new FilterSetCollection();
if (filtering) { if (filtering) {
executionFilters executionFilters
.addFilterSet(project.getGlobalFilterSet());
.addFilterSet(getProject().getGlobalFilterSet());
} }
for (Enumeration filterEnum = filterSets.elements(); for (Enumeration filterEnum = filterSets.elements();
filterEnum.hasMoreElements();) { filterEnum.hasMoreElements();) {
@@ -527,7 +527,7 @@ public class Copy extends Task {
fileUtils.copyFile(fromFile, toFile, executionFilters, fileUtils.copyFile(fromFile, toFile, executionFilters,
filterChains, forceOverwrite, filterChains, forceOverwrite,
preserveLastModified, encoding, preserveLastModified, encoding,
project);
getProject());
} catch (IOException ioe) { } catch (IOException ioe) {
String msg = "Failed to copy " + fromFile + " to " + toFile String msg = "Failed to copy " + fromFile + " to " + toFile
+ " due to " + ioe.getMessage(); + " due to " + ioe.getMessage();


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Copydir.java View File

@@ -137,7 +137,7 @@ public class Copydir extends MatchingTask {
String fromFile = (String) enum.nextElement(); String fromFile = (String) enum.nextElement();
String toFile = (String) filecopyList.get(fromFile); String toFile = (String) filecopyList.get(fromFile);
try { try {
project.copyFile(fromFile, toFile, filtering,
getProject().copyFile(fromFile, toFile, filtering,
forceOverwrite); forceOverwrite);
} catch (IOException ioe) { } catch (IOException ioe) {
String msg = "Failed to copy " + fromFile + " to " String msg = "Failed to copy " + fromFile + " to "


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Copyfile.java View File

@@ -120,7 +120,7 @@ public class Copyfile extends Task {
if (forceOverwrite if (forceOverwrite
|| srcFile.lastModified() > destFile.lastModified()) { || srcFile.lastModified() > destFile.lastModified()) {
try { try {
project.copyFile(srcFile, destFile, filtering, forceOverwrite);
getProject().copyFile(srcFile, destFile, filtering, forceOverwrite);
} catch (IOException ioe) { } catch (IOException ioe) {
String msg = "Error copying file: " + srcFile.getAbsolutePath() String msg = "Error copying file: " + srcFile.getAbsolutePath()
+ " due to " + ioe.getMessage(); + " due to " + ioe.getMessage();


+ 7
- 7
src/main/org/apache/tools/ant/taskdefs/Definer.java View File

@@ -117,7 +117,7 @@ public abstract class Definer extends Task {
*/ */
public Path createClasspath() { public Path createClasspath() {
if (this.classpath == null) { if (this.classpath == null) {
this.classpath = new Path(project);
this.classpath = new Path(getProject());
} }
return this.classpath.createPath(); return this.classpath.createPath();
} }
@@ -246,7 +246,7 @@ public abstract class Definer extends Task {
*/ */
private AntClassLoader createLoader() { private AntClassLoader createLoader() {
// magic property // magic property
if (project.getProperty(REUSE_LOADER_REF) != null) {
if (getProject().getProperty(REUSE_LOADER_REF) != null) {
// Generate the 'reuse' name automatically from the reference. // Generate the 'reuse' name automatically from the reference.
// This allows <taskdefs> that work on both ant1.4 and ant1.5. // This allows <taskdefs> that work on both ant1.4 and ant1.5.
// ( in 1.4 it'll require the task/type to be in classpath if they // ( in 1.4 it'll require the task/type to be in classpath if they
@@ -258,7 +258,7 @@ public abstract class Definer extends Task {


// If a loader has been set ( either by loaderRef or magic property ) // If a loader has been set ( either by loaderRef or magic property )
if (loaderId != null) { if (loaderId != null) {
Object reusedLoader = project.getReference(loaderId);
Object reusedLoader = getProject().getReference(loaderId);
if (reusedLoader != null) { if (reusedLoader != null) {
if (reusedLoader instanceof AntClassLoader) { if (reusedLoader instanceof AntClassLoader) {
return (AntClassLoader)reusedLoader; return (AntClassLoader)reusedLoader;
@@ -272,9 +272,9 @@ public abstract class Definer extends Task {


AntClassLoader al = null; AntClassLoader al = null;
if (classpath != null) { if (classpath != null) {
al = new AntClassLoader(project, classpath, !reverseLoader);
al = new AntClassLoader(getProject(), classpath, !reverseLoader);
} else { } else {
al = new AntClassLoader(project, Path.systemClasspath,
al = new AntClassLoader(getProject(), Path.systemClasspath,
!reverseLoader); !reverseLoader);
} }
// need to load Task via system classloader or the new // need to load Task via system classloader or the new
@@ -286,8 +286,8 @@ public abstract class Definer extends Task {
// If the loader is new, record it for future uses by other // If the loader is new, record it for future uses by other
// task/typedefs // task/typedefs
if (loaderId != null) { if (loaderId != null) {
if (project.getReference(loaderId) == null) {
project.addReference(loaderId, al);
if (getProject().getReference(loaderId) == null) {
getProject().addReference(loaderId, al);
} }
} }




+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/Delete.java View File

@@ -331,10 +331,10 @@ public class Delete extends MatchingTask {
for (int i = 0; i < filesets.size(); i++) { for (int i = 0; i < filesets.size(); i++) {
FileSet fs = (FileSet) filesets.elementAt(i); FileSet fs = (FileSet) filesets.elementAt(i);
try { try {
DirectoryScanner ds = fs.getDirectoryScanner(project);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
String[] files = ds.getIncludedFiles(); String[] files = ds.getIncludedFiles();
String[] dirs = ds.getIncludedDirectories(); String[] dirs = ds.getIncludedDirectories();
removeFiles(fs.getDir(project), files, dirs);
removeFiles(fs.getDir(getProject()), files, dirs);
} catch (BuildException be) { } catch (BuildException be) {
// directory doesn't exist or is not readable // directory doesn't exist or is not readable
if (failonerror) { if (failonerror) {


+ 8
- 8
src/main/org/apache/tools/ant/taskdefs/DependSet.java View File

@@ -195,12 +195,12 @@ public class DependSet extends MatchingTask {
continue; continue;
} }


DirectoryScanner targetDS = targetFS.getDirectoryScanner(project);
DirectoryScanner targetDS = targetFS.getDirectoryScanner(getProject());
String[] targetFiles = targetDS.getIncludedFiles(); String[] targetFiles = targetDS.getIncludedFiles();


for (int i = 0; i < targetFiles.length; i++) { for (int i = 0; i < targetFiles.length; i++) {


File dest = new File(targetFS.getDir(project), targetFiles[i]);
File dest = new File(targetFS.getDir(getProject()), targetFiles[i]);
allTargets.addElement(dest); allTargets.addElement(dest);


if (dest.lastModified() > now) { if (dest.lastModified() > now) {
@@ -224,11 +224,11 @@ public class DependSet extends MatchingTask {
while (enumTargetLists.hasMoreElements()) { while (enumTargetLists.hasMoreElements()) {


FileList targetFL = (FileList) enumTargetLists.nextElement(); FileList targetFL = (FileList) enumTargetLists.nextElement();
String[] targetFiles = targetFL.getFiles(project);
String[] targetFiles = targetFL.getFiles(getProject());


for (int i = 0; i < targetFiles.length; i++) { for (int i = 0; i < targetFiles.length; i++) {


File dest = new File(targetFL.getDir(project), targetFiles[i]);
File dest = new File(targetFL.getDir(getProject()), targetFiles[i]);
if (!dest.exists()) { if (!dest.exists()) {
log(targetFiles[i] + " does not exist.", Project.MSG_VERBOSE); log(targetFiles[i] + " does not exist.", Project.MSG_VERBOSE);
upToDate = false; upToDate = false;
@@ -264,10 +264,10 @@ public class DependSet extends MatchingTask {
while (upToDate && enumSourceLists.hasMoreElements()) { while (upToDate && enumSourceLists.hasMoreElements()) {


FileList sourceFL = (FileList) enumSourceLists.nextElement(); FileList sourceFL = (FileList) enumSourceLists.nextElement();
String[] sourceFiles = sourceFL.getFiles(project);
String[] sourceFiles = sourceFL.getFiles(getProject());


for (int i = 0; upToDate && i < sourceFiles.length; i++) { for (int i = 0; upToDate && i < sourceFiles.length; i++) {
File src = new File(sourceFL.getDir(project), sourceFiles[i]);
File src = new File(sourceFL.getDir(getProject()), sourceFiles[i]);


if (src.lastModified() > now) { if (src.lastModified() > now) {
log("Warning: " + sourceFiles[i] log("Warning: " + sourceFiles[i]
@@ -298,11 +298,11 @@ public class DependSet extends MatchingTask {
while (upToDate && enumSourceSets.hasMoreElements()) { while (upToDate && enumSourceSets.hasMoreElements()) {


FileSet sourceFS = (FileSet) enumSourceSets.nextElement(); FileSet sourceFS = (FileSet) enumSourceSets.nextElement();
DirectoryScanner sourceDS = sourceFS.getDirectoryScanner(project);
DirectoryScanner sourceDS = sourceFS.getDirectoryScanner(getProject());
String[] sourceFiles = sourceDS.getIncludedFiles(); String[] sourceFiles = sourceDS.getIncludedFiles();


for (int i = 0; upToDate && i < sourceFiles.length; i++) { for (int i = 0; upToDate && i < sourceFiles.length; i++) {
File src = new File(sourceFS.getDir(project), sourceFiles[i]);
File src = new File(sourceFS.getDir(getProject()), sourceFiles[i]);


if (src.lastModified() > now) { if (src.lastModified() > now) {
log("Warning: " + sourceFiles[i] log("Warning: " + sourceFiles[i]


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Echo.java View File

@@ -131,7 +131,7 @@ public class Echo extends Task {
* Set a multiline message. * Set a multiline message.
*/ */
public void addText(String msg) { public void addText(String msg) {
message += project.replaceProperties(msg);
message += getProject().replaceProperties(msg);
} }


/** /**


+ 10
- 15
src/main/org/apache/tools/ant/taskdefs/Exec.java View File

@@ -87,8 +87,6 @@ public class Exec extends Task {
protected PrintWriter fos = null; protected PrintWriter fos = null;
private boolean failOnError = false; private boolean failOnError = false;


private static final int BUFFER_SIZE = 512;

public Exec() { public Exec() {
System.err.println("As of Ant 1.2 released in October 2000, " System.err.println("As of Ant 1.2 released in October 2000, "
+ "the Exec class"); + "the Exec class");
@@ -116,31 +114,31 @@ public class Exec extends Task {


// default directory to the project's base directory // default directory to the project's base directory
if (dir == null) { if (dir == null) {
dir = project.getBaseDir();
dir = getProject().getBaseDir();
} }


if (myos.toLowerCase().indexOf("windows") >= 0) { if (myos.toLowerCase().indexOf("windows") >= 0) {
if (!dir.equals(project.resolveFile("."))) {
if (!dir.equals(getProject().resolveFile("."))) {
if (myos.toLowerCase().indexOf("nt") >= 0) { if (myos.toLowerCase().indexOf("nt") >= 0) {
command = "cmd /c cd " + dir + " && " + command; command = "cmd /c cd " + dir + " && " + command;
} else { } else {
String ant = project.getProperty("ant.home");
String ant = getProject().getProperty("ant.home");
if (ant == null) { if (ant == null) {
throw new BuildException("Property 'ant.home' not " throw new BuildException("Property 'ant.home' not "
+ "found", location); + "found", location);
} }
String antRun = project.resolveFile(ant + "/bin/antRun.bat").toString();
String antRun = getProject().resolveFile(ant + "/bin/antRun.bat").toString();
command = antRun + " " + dir + " " + command; command = antRun + " " + dir + " " + command;
} }
} }
} else { } else {
String ant = project.getProperty("ant.home");
String ant = getProject().getProperty("ant.home");
if (ant == null) { if (ant == null) {
throw new BuildException("Property 'ant.home' not found", throw new BuildException("Property 'ant.home' not found",
location); location);
} }
String antRun = project.resolveFile(ant + "/bin/antRun").toString();
String antRun = getProject().resolveFile(ant + "/bin/antRun").toString();


command = antRun + " " + dir + " " + command; command = antRun + " " + dir + " " + command;
} }
@@ -159,9 +157,9 @@ public class Exec extends Task {


// copy input and error to the output stream // copy input and error to the output stream
StreamPumper inputPumper = StreamPumper inputPumper =
new StreamPumper(proc.getInputStream(), Project.MSG_INFO, this);
new StreamPumper(proc.getInputStream(), Project.MSG_INFO);
StreamPumper errorPumper = StreamPumper errorPumper =
new StreamPumper(proc.getErrorStream(), Project.MSG_WARN, this);
new StreamPumper(proc.getErrorStream(), Project.MSG_WARN);


// starts pumping away the generated output/error // starts pumping away the generated output/error
inputPumper.start(); inputPumper.start();
@@ -193,7 +191,7 @@ public class Exec extends Task {
} }


public void setDir(String d) { public void setDir(String d) {
this.dir = project.resolveFile(d);
this.dir = getProject().resolveFile(d);
} }


public void setOs(String os) { public void setOs(String os) {
@@ -233,16 +231,13 @@ public class Exec extends Task {
private int messageLevel; private int messageLevel;
private boolean endOfStream = false; private boolean endOfStream = false;
private int SLEEP_TIME = 5; private int SLEEP_TIME = 5;
private Exec parent;


public StreamPumper(InputStream is, int messageLevel, Exec parent) {
public StreamPumper(InputStream is, int messageLevel) {
this.din = new BufferedReader(new InputStreamReader(is)); this.din = new BufferedReader(new InputStreamReader(is));
this.messageLevel = messageLevel; this.messageLevel = messageLevel;
this.parent = parent;
} }


public void pumpStream() throws IOException { public void pumpStream() throws IOException {
byte[] buf = new byte[BUFFER_SIZE];
if (!endOfStream) { if (!endOfStream) {
String line = din.readLine(); String line = din.readLine();




+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/ExecTask.java View File

@@ -216,7 +216,7 @@ public class ExecTask extends Task {
protected void maybeSetResultPropertyValue(int result) { protected void maybeSetResultPropertyValue(int result) {
String res = Integer.toString(result); String res = Integer.toString(result);
if (resultProperty != null) { if (resultProperty != null) {
project.setNewProperty(resultProperty, res);
getProject().setNewProperty(resultProperty, res);
} }
} }


@@ -301,7 +301,7 @@ public class ExecTask extends Task {
protected Execute prepareExec() throws BuildException { protected Execute prepareExec() throws BuildException {
// default directory to the project's base directory // default directory to the project's base directory
if (dir == null) { if (dir == null) {
dir = project.getBaseDir();
dir = getProject().getBaseDir();
} }
Execute exe = new Execute(createHandler(), createWatchdog()); Execute exe = new Execute(createHandler(), createWatchdog());
exe.setAntRun(getProject()); exe.setAntRun(getProject());
@@ -351,7 +351,7 @@ public class ExecTask extends Task {
} }
val.append(line); val.append(line);
} }
project.setNewProperty(outputprop, val.toString());
getProject().setNewProperty(outputprop, val.toString());
} }
} }




+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java View File

@@ -180,7 +180,7 @@ public class ExecuteOn extends ExecTask {
throw new BuildException("Cannot define more than one mapper", throw new BuildException("Cannot define more than one mapper",
location); location);
} }
mapperElement = new Mapper(project);
mapperElement = new Mapper(getProject());
return mapperElement; return mapperElement;
} }


@@ -219,8 +219,8 @@ public class ExecuteOn extends ExecTask {
Vector baseDirs = new Vector(); Vector baseDirs = new Vector();
for (int i = 0; i < filesets.size(); i++) { for (int i = 0; i < filesets.size(); i++) {
FileSet fs = (FileSet) filesets.elementAt(i); FileSet fs = (FileSet) filesets.elementAt(i);
File base = fs.getDir(project);
DirectoryScanner ds = fs.getDirectoryScanner(project);
File base = fs.getDir(getProject());
DirectoryScanner ds = fs.getDirectoryScanner(getProject());


if (!"dir".equals(type)) { if (!"dir".equals(type)) {
String[] s = getFiles(base, ds); String[] s = getFiles(base, ds);


+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/Exit.java View File

@@ -115,7 +115,7 @@ public class Exit extends Task {
if (message == null) { if (message == null) {
message = ""; message = "";
} }
message += project.replaceProperties(msg);
message += getProject().replaceProperties(msg);
} }


private boolean testIfCondition() { private boolean testIfCondition() {
@@ -123,14 +123,14 @@ public class Exit extends Task {
return true; return true;
} }


return project.getProperty(ifCondition) != null;
return getProject().getProperty(ifCondition) != null;
} }


private boolean testUnlessCondition() { private boolean testUnlessCondition() {
if (unlessCondition == null || "".equals(unlessCondition)) { if (unlessCondition == null || "".equals(unlessCondition)) {
return true; return true;
} }
return project.getProperty(unlessCondition) == null;
return getProject().getProperty(unlessCondition) == null;
} }


} }

+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/Expand.java View File

@@ -130,8 +130,8 @@ public class Expand extends Task {
if (filesets.size() > 0) { if (filesets.size() > 0) {
for (int j = 0; j < filesets.size(); j++) { for (int j = 0; j < filesets.size(); j++) {
FileSet fs = (FileSet) filesets.elementAt(j); FileSet fs = (FileSet) filesets.elementAt(j);
DirectoryScanner ds = fs.getDirectoryScanner(project);
File fromDir = fs.getDir(project);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
File fromDir = fs.getDir(getProject());


String[] files = ds.getIncludedFiles(); String[] files = ds.getIncludedFiles();
for (int i = 0; i < files.length; ++i) { for (int i = 0; i < files.length; ++i) {
@@ -183,7 +183,7 @@ public class Expand extends Task {
boolean included = false; boolean included = false;
for (int v = 0; v < patternsets.size(); v++) { for (int v = 0; v < patternsets.size(); v++) {
PatternSet p = (PatternSet) patternsets.elementAt(v); PatternSet p = (PatternSet) patternsets.elementAt(v);
String[] incls = p.getIncludePatterns(project);
String[] incls = p.getIncludePatterns(getProject());
if (incls != null) { if (incls != null) {
for (int w = 0; w < incls.length; w++) { for (int w = 0; w < incls.length; w++) {
boolean isIncl = boolean isIncl =
@@ -194,7 +194,7 @@ public class Expand extends Task {
} }
} }
} }
String[] excls = p.getExcludePatterns(project);
String[] excls = p.getExcludePatterns(getProject());
if (excls != null) { if (excls != null) {
for (int w = 0; w < excls.length; w++) { for (int w = 0; w < excls.length; w++) {
boolean isExcl = boolean isExcl =


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/Filter.java View File

@@ -119,7 +119,7 @@ public class Filter extends Task {
} }


if (isSingleFilter) { if (isSingleFilter) {
project.getGlobalFilterSet().addFilter(token, value);
getProject().getGlobalFilterSet().addFilter(token, value);
} }


if (isFiltersFromFile) { if (isFiltersFromFile) {
@@ -129,6 +129,6 @@ public class Filter extends Task {


protected void readFilters() throws BuildException { protected void readFilters() throws BuildException {
log("Reading filters from " + filtersFile, Project.MSG_VERBOSE); log("Reading filters from " + filtersFile, Project.MSG_VERBOSE);
project.getGlobalFilterSet().readFiltersFromFile(filtersFile);
getProject().getGlobalFilterSet().readFiltersFromFile(filtersFile);
} }
} }

+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/GenerateKey.java View File

@@ -400,7 +400,7 @@ public class GenerateKey extends Task {
} }


log("Generating Key for " + alias); log("Generating Key for " + alias);
final ExecTask cmd = (ExecTask) project.createTask("exec");
final ExecTask cmd = (ExecTask) getProject().createTask("exec");
cmd.setExecutable("keytool"); cmd.setExecutable("keytool");
Commandline.Argument arg = cmd.createArg(); Commandline.Argument arg = cmd.createArg();
arg.setLine(sb.toString()); arg.setLine(sb.toString());


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Input.java View File

@@ -155,7 +155,7 @@ public class Input extends Task {
value = defaultvalue; value = defaultvalue;
} }
if (addproperty != null) { if (addproperty != null) {
project.setNewProperty(addproperty, value);
getProject().setNewProperty(addproperty, value);
} }
} }




+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/JDBCTask.java View File

@@ -204,7 +204,7 @@ public abstract class JDBCTask extends Task {
*/ */
public Path createClasspath() { public Path createClasspath() {
if (this.classpath == null) { if (this.classpath == null) {
this.classpath = new Path(project);
this.classpath = new Path(getProject());
} }
return this.classpath.createPath(); return this.classpath.createPath();
} }
@@ -383,7 +383,7 @@ public abstract class JDBCTask extends Task {
log( log(
"Loading " + driver + " using AntClassLoader with classpath " + classpath, "Loading " + driver + " using AntClassLoader with classpath " + classpath,
Project.MSG_VERBOSE); Project.MSG_VERBOSE);
loader = new AntClassLoader(project, classpath);
loader = new AntClassLoader(getProject(), classpath);
if (caching) { if (caching) {
loaderMap.put(driver, loader); loaderMap.put(driver, loader);
} }


+ 5
- 5
src/main/org/apache/tools/ant/taskdefs/Java.java View File

@@ -196,7 +196,7 @@ public class Java extends Task {
* Adds a path to the classpath. * Adds a path to the classpath.
*/ */
public Path createClasspath() { public Path createClasspath() {
return cmdl.createClasspath(project).createPath();
return cmdl.createClasspath(getProject()).createPath();
} }


/** /**
@@ -403,7 +403,7 @@ public class Java extends Task {
outStream = outStream =
new PrintStream(new FileOutputStream(out.getAbsolutePath(), new PrintStream(new FileOutputStream(out.getAbsolutePath(),
append)); append));
exe.execute(project);
exe.execute(getProject());
} catch (IOException io) { } catch (IOException io) {
throw new BuildException(io, location); throw new BuildException(io, location);
} finally { } finally {
@@ -412,7 +412,7 @@ public class Java extends Task {
} }
} }
} else { } else {
exe.execute(project);
exe.execute(getProject());
} }
} }


@@ -433,10 +433,10 @@ public class Java extends Task {
createWatchdog()); createWatchdog());
} }
exe.setAntRun(project);
exe.setAntRun(getProject());
if (dir == null) { if (dir == null) {
dir = project.getBaseDir();
dir = getProject().getBaseDir();
} else if (!dir.exists() || !dir.isDirectory()) { } else if (!dir.exists() || !dir.isDirectory()) {
throw new BuildException(dir.getAbsolutePath() throw new BuildException(dir.getAbsolutePath()
+ " is not a valid directory", + " is not a valid directory",


+ 6
- 6
src/main/org/apache/tools/ant/taskdefs/Javac.java View File

@@ -214,7 +214,7 @@ public class Javac extends MatchingTask {
*/ */
public Path createSrc() { public Path createSrc() {
if (src == null) { if (src == null) {
src = new Path(project);
src = new Path(getProject());
} }
return src.createPath(); return src.createPath();
} }
@@ -282,7 +282,7 @@ public class Javac extends MatchingTask {
*/ */
public Path createSourcepath() { public Path createSourcepath() {
if (compileSourcepath == null) { if (compileSourcepath == null) {
compileSourcepath = new Path(project);
compileSourcepath = new Path(getProject());
} }
return compileSourcepath.createPath(); return compileSourcepath.createPath();
} }
@@ -317,7 +317,7 @@ public class Javac extends MatchingTask {
*/ */
public Path createClasspath() { public Path createClasspath() {
if (compileClasspath == null) { if (compileClasspath == null) {
compileClasspath = new Path(project);
compileClasspath = new Path(getProject());
} }
return compileClasspath.createPath(); return compileClasspath.createPath();
} }
@@ -354,7 +354,7 @@ public class Javac extends MatchingTask {
*/ */
public Path createBootclasspath() { public Path createBootclasspath() {
if (bootclasspath == null) { if (bootclasspath == null) {
bootclasspath = new Path(project);
bootclasspath = new Path(getProject());
} }
return bootclasspath.createPath(); return bootclasspath.createPath();
} }
@@ -391,7 +391,7 @@ public class Javac extends MatchingTask {
*/ */
public Path createExtdirs() { public Path createExtdirs() {
if (extdirs == null) { if (extdirs == null) {
extdirs = new Path(project);
extdirs = new Path(getProject());
} }
return extdirs.createPath(); return extdirs.createPath();
} }
@@ -666,7 +666,7 @@ public class Javac extends MatchingTask {
// compile lists // compile lists
String[] list = src.list(); String[] list = src.list();
for (int i = 0; i < list.length; i++) { for (int i = 0; i < list.length; i++) {
File srcDir = project.resolveFile(list[i]);
File srcDir = getProject().resolveFile(list[i]);
if (!srcDir.exists()) { if (!srcDir.exists()) {
throw new BuildException("srcdir \"" throw new BuildException("srcdir \""
+ srcDir.getPath() + srcDir.getPath()


+ 7
- 7
src/main/org/apache/tools/ant/taskdefs/Javadoc.java View File

@@ -535,7 +535,7 @@ public class Javadoc extends Task {
*/ */
public Path createSourcepath() { public Path createSourcepath() {
if (sourcePath == null) { if (sourcePath == null) {
sourcePath = new Path(project);
sourcePath = new Path(getProject());
} }
return sourcePath.createPath(); return sourcePath.createPath();
} }
@@ -570,7 +570,7 @@ public class Javadoc extends Task {
while (tok.hasMoreTokens()) { while (tok.hasMoreTokens()) {
String f = tok.nextToken(); String f = tok.nextToken();
SourceFile sf = new SourceFile(); SourceFile sf = new SourceFile();
sf.setFile(project.resolveFile(f));
sf.setFile(getProject().resolveFile(f));
addSource(sf); addSource(sf);
} }
} }
@@ -806,7 +806,7 @@ public class Javadoc extends Task {
*/ */
public Path createClasspath() { public Path createClasspath() {
if (classpath == null) { if (classpath == null) {
classpath = new Path(project);
classpath = new Path(getProject());
} }
return classpath.createPath(); return classpath.createPath();
} }
@@ -840,7 +840,7 @@ public class Javadoc extends Task {
*/ */
public Path createBootclasspath() { public Path createBootclasspath() {
if (bootclasspath == null) { if (bootclasspath == null) {
bootclasspath = new Path(project);
bootclasspath = new Path(getProject());
} }
return bootclasspath.createPath(); return bootclasspath.createPath();
} }
@@ -1067,7 +1067,7 @@ public class Javadoc extends Task {
if (!tok.hasMoreTokens()) { if (!tok.hasMoreTokens()) {
throw new BuildException(linkOfflineError); throw new BuildException(linkOfflineError);
} }
le.setPackagelistLoc(project.resolveFile(tok.nextToken()));
le.setPackagelistLoc(getProject().resolveFile(tok.nextToken()));
} }
} }


@@ -1823,7 +1823,7 @@ public class Javadoc extends Task {
JavadocOutputStream out = new JavadocOutputStream(Project.MSG_INFO); JavadocOutputStream out = new JavadocOutputStream(Project.MSG_INFO);
JavadocOutputStream err = new JavadocOutputStream(Project.MSG_WARN); JavadocOutputStream err = new JavadocOutputStream(Project.MSG_WARN);
Execute exe = new Execute(new PumpStreamHandler(out, err)); Execute exe = new Execute(new PumpStreamHandler(out, err));
exe.setAntRun(project);
exe.setAntRun(getProject());


/* /*
* No reason to change the working directory as all filenames and * No reason to change the working directory as all filenames and
@@ -2012,7 +2012,7 @@ public class Javadoc extends Task {
* Convenience method to expand properties. * Convenience method to expand properties.
*/ */
protected String expand(String content) { protected String expand(String content) {
return project.replaceProperties(content);
return getProject().replaceProperties(content);
} }


} }

+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/LoadFile.java View File

@@ -188,7 +188,7 @@ public final class LoadFile extends Task {
crh.setBufferSize(size); crh.setBufferSize(size);
crh.setPrimaryReader(instream); crh.setPrimaryReader(instream);
crh.setFilterChains(filterChains); crh.setFilterChains(filterChains);
crh.setProject(project);
crh.setProject(getProject());
instream = crh.getAssembledReader(); instream = crh.getAssembledReader();
text = crh.readFully(instream); text = crh.readFully(instream);
@@ -196,7 +196,7 @@ public final class LoadFile extends Task {


if (text != null) { if (text != null) {
if (text.length() > 0) { if (text.length() > 0) {
project.setNewProperty(property, text);
getProject().setNewProperty(property, text);
log("loaded " + text.length() + " characters", log("loaded " + text.length() + " characters",
Project.MSG_VERBOSE); Project.MSG_VERBOSE);
log(property + " := " + text, Project.MSG_DEBUG); log(property + " := " + text, Project.MSG_DEBUG);


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/LoadProperties.java View File

@@ -158,7 +158,7 @@ public final class LoadProperties extends Task {
crh.setBufferSize(size); crh.setBufferSize(size);
crh.setPrimaryReader(instream); crh.setPrimaryReader(instream);
crh.setFilterChains(filterChains); crh.setFilterChains(filterChains);
crh.setProject(project);
crh.setProject(getProject());
instream = crh.getAssembledReader(); instream = crh.getAssembledReader();


String text = crh.readFully(instream); String text = crh.readFully(instream);
@@ -182,7 +182,7 @@ public final class LoadProperties extends Task {
final String value = props.getProperty(key); final String value = props.getProperty(key);
if (key != null && value != null if (key != null && value != null
&& value.trim().length() > 0) { && value.trim().length() > 0) {
project.setNewProperty(key, value);
getProject().setNewProperty(key, value);
} }
} }
tis.close(); tis.close();


+ 1
- 2
src/main/org/apache/tools/ant/taskdefs/MatchingTask.java View File

@@ -209,7 +209,7 @@ public abstract class MatchingTask extends Task implements SelectorContainer {
protected DirectoryScanner getDirectoryScanner(File baseDir) { protected DirectoryScanner getDirectoryScanner(File baseDir) {
fileset.setDir(baseDir); fileset.setDir(baseDir);
fileset.setDefaultexcludes(useDefaultExcludes); fileset.setDefaultexcludes(useDefaultExcludes);
return fileset.getDirectoryScanner(project);
return fileset.getDirectoryScanner(getProject());
} }


/** /**
@@ -291,7 +291,6 @@ public abstract class MatchingTask extends Task implements SelectorContainer {
* Add a new selector into this container. * Add a new selector into this container.
* *
* @param selector the new selector to add * @param selector the new selector to add
* @return the selector that was added
*/ */
public void appendSelector(FileSelector selector) { public void appendSelector(FileSelector selector) {
fileset.appendSelector(selector); fileset.appendSelector(selector);


+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/Move.java View File

@@ -160,7 +160,7 @@ public class Move extends Copy {
new FilterSetCollection(); new FilterSetCollection();
if (filtering) { if (filtering) {
executionFilters executionFilters
.addFilterSet(project.getGlobalFilterSet());
.addFilterSet(getProject().getGlobalFilterSet());
} }
for (Enumeration filterEnum = for (Enumeration filterEnum =
getFilterSets().elements(); getFilterSets().elements();
@@ -173,7 +173,7 @@ public class Move extends Copy {
getFilterChains(), getFilterChains(),
forceOverwrite, forceOverwrite,
getPreserveLastModified(), getPreserveLastModified(),
getEncoding(), project);
getEncoding(), getProject());


f = new File(fromFile); f = new File(fromFile);
if (!f.delete()) { if (!f.delete()) {
@@ -217,7 +217,7 @@ public class Move extends Copy {
Enumeration e = filesets.elements(); Enumeration e = filesets.elements();
while (e.hasMoreElements()) { while (e.hasMoreElements()) {
FileSet fs = (FileSet) e.nextElement(); FileSet fs = (FileSet) e.nextElement();
File dir = fs.getDir(project);
File dir = fs.getDir(getProject());


if (okToDelete(dir)) { if (okToDelete(dir)) {
deleteDir(dir); deleteDir(dir);


+ 6
- 6
src/main/org/apache/tools/ant/taskdefs/Property.java View File

@@ -276,7 +276,7 @@ public class Property extends Task {
*/ */
public Path createClasspath() { public Path createClasspath() {
if (this.classpath == null) { if (this.classpath == null) {
this.classpath = new Path(project);
this.classpath = new Path(getProject());
} }
return this.classpath.createPath(); return this.classpath.createPath();
} }
@@ -408,7 +408,7 @@ public class Property extends Task {
ClassLoader cL = null; ClassLoader cL = null;


if (classpath != null) { if (classpath != null) {
cL = new AntClassLoader(project, classpath);
cL = new AntClassLoader(getProject(), classpath);
} else { } else {
cL = this.getClass().getClassLoader(); cL = this.getClass().getClassLoader();
} }
@@ -472,7 +472,7 @@ public class Property extends Task {
String name = (String) e.nextElement(); String name = (String) e.nextElement();
String value = props.getProperty(name); String value = props.getProperty(name);


String v = project.replaceProperties(value);
String v = getProject().replaceProperties(value);


if (prefix != null) { if (prefix != null) {
name = prefix + name; name = prefix + name;
@@ -489,13 +489,13 @@ public class Property extends Task {
*/ */
protected void addProperty(String n, String v) { protected void addProperty(String n, String v) {
if (userProperty) { if (userProperty) {
if (project.getUserProperty(n) == null) {
project.setInheritedProperty(n, v);
if (getProject().getUserProperty(n) == null) {
getProject().setInheritedProperty(n, v);
} else { } else {
log("Override ignored for " + n, Project.MSG_VERBOSE); log("Override ignored for " + n, Project.MSG_VERBOSE);
} }
} else { } else {
project.setNewProperty(n, v);
getProject().setNewProperty(n, v);
} }
} }




+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/Rmic.java View File

@@ -259,7 +259,7 @@ public class Rmic extends MatchingTask {
*/ */
public Path createClasspath() { public Path createClasspath() {
if (compileClasspath == null) { if (compileClasspath == null) {
compileClasspath = new Path(project);
compileClasspath = new Path(getProject());
} }
return compileClasspath.createPath(); return compileClasspath.createPath();
} }
@@ -414,7 +414,7 @@ public class Rmic extends MatchingTask {
*/ */
public Path createExtdirs() { public Path createExtdirs() {
if (extdirs == null) { if (extdirs == null) {
extdirs = new Path(project);
extdirs = new Path(getProject());
} }
return extdirs.createPath(); return extdirs.createPath();
} }
@@ -493,7 +493,7 @@ public class Rmic extends MatchingTask {
adapter.setRmic(this); adapter.setRmic(this);


Path classpath = adapter.getClasspath(); Path classpath = adapter.getClasspath();
loader = new AntClassLoader(project, classpath);
loader = new AntClassLoader(getProject(), classpath);


try { try {
// scan base dirs to build up compile lists only if a // scan base dirs to build up compile lists only if a


+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/SQLExec.java View File

@@ -338,8 +338,8 @@ public class SQLExec extends JDBCTask {
// deal with the filesets // deal with the filesets
for (int i = 0; i < filesets.size(); i++) { for (int i = 0; i < filesets.size(); i++) {
FileSet fs = (FileSet) filesets.elementAt(i); FileSet fs = (FileSet) filesets.elementAt(i);
DirectoryScanner ds = fs.getDirectoryScanner(project);
File srcDir = fs.getDir(project);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
File srcDir = fs.getDir(getProject());


String[] srcFiles = ds.getIncludedFiles(); String[] srcFiles = ds.getIncludedFiles();


@@ -435,7 +435,7 @@ public class SQLExec extends JDBCTask {


while ((line = in.readLine()) != null){ while ((line = in.readLine()) != null){
line = line.trim(); line = line.trim();
line = project.replaceProperties(line);
line = getProject().replaceProperties(line);
if (line.startsWith("//")) { if (line.startsWith("//")) {
continue; continue;
} }


+ 3
- 4
src/main/org/apache/tools/ant/taskdefs/SignJar.java View File

@@ -62,7 +62,6 @@ import java.util.zip.ZipFile;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;


import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.util.JavaEnvUtils; import org.apache.tools.ant.util.JavaEnvUtils;
@@ -235,10 +234,10 @@ public class SignJar extends Task {
// deal with the filesets // deal with the filesets
for (int i = 0; i < filesets.size(); i++) { for (int i = 0; i < filesets.size(); i++) {
FileSet fs = (FileSet) filesets.elementAt(i); FileSet fs = (FileSet) filesets.elementAt(i);
DirectoryScanner ds = fs.getDirectoryScanner(project);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
String[] jarFiles = ds.getIncludedFiles(); String[] jarFiles = ds.getIncludedFiles();
for (int j = 0; j < jarFiles.length; j++) { for (int j = 0; j < jarFiles.length; j++) {
doOneJar(new File(fs.getDir(project), jarFiles[j]), null);
doOneJar(new File(fs.getDir(getProject()), jarFiles[j]), null);
} }
} }
} }
@@ -266,7 +265,7 @@ public class SignJar extends Task {
return; return;
} }


final ExecTask cmd = (ExecTask) project.createTask("exec");
final ExecTask cmd = (ExecTask) getProject().createTask("exec");
cmd.setExecutable("jarsigner"); cmd.setExecutable("jarsigner");


if (null != keystore) { if (null != keystore) {


+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/Tar.java View File

@@ -265,14 +265,14 @@ public class Tar extends MatchingTask {
boolean upToDate = true; boolean upToDate = true;
for (Enumeration e = filesets.elements(); e.hasMoreElements();) { for (Enumeration e = filesets.elements(); e.hasMoreElements();) {
TarFileSet fs = (TarFileSet) e.nextElement(); TarFileSet fs = (TarFileSet) e.nextElement();
String[] files = fs.getFiles(project);
String[] files = fs.getFiles(getProject());


if (!archiveIsUpToDate(files)) { if (!archiveIsUpToDate(files)) {
upToDate = false; upToDate = false;
} }


for (int i = 0; i < files.length; ++i) { for (int i = 0; i < files.length; ++i) {
if (tarFile.equals(new File(fs.getDir(project),
if (tarFile.equals(new File(fs.getDir(getProject()),
files[i]))) { files[i]))) {
throw new BuildException("A tar file cannot include " throw new BuildException("A tar file cannot include "
+ "itself", location); + "itself", location);
@@ -309,7 +309,7 @@ public class Tar extends MatchingTask {
for (Enumeration e = filesets.elements(); for (Enumeration e = filesets.elements();
e.hasMoreElements();) { e.hasMoreElements();) {
TarFileSet fs = (TarFileSet) e.nextElement(); TarFileSet fs = (TarFileSet) e.nextElement();
String[] files = fs.getFiles(project);
String[] files = fs.getFiles(getProject());
if (files.length > 1 && fs.getFullpath().length() > 0) { if (files.length > 1 && fs.getFullpath().length() > 0) {
throw new BuildException("fullpath attribute may only " throw new BuildException("fullpath attribute may only "
+ "be specified for " + "be specified for "
@@ -317,7 +317,7 @@ public class Tar extends MatchingTask {
+ "single file."); + "single file.");
} }
for (int i = 0; i < files.length; i++) { for (int i = 0; i < files.length; i++) {
File f = new File(fs.getDir(project), files[i]);
File f = new File(fs.getDir(getProject()), files[i]);
String name = files[i].replace(File.separatorChar, '/'); String name = files[i].replace(File.separatorChar, '/');
tarFile(f, tOut, name, fs); tarFile(f, tOut, name, fs);
} }


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Taskdef.java View File

@@ -79,6 +79,6 @@ public class Taskdef extends Definer {
* execution. * execution.
*/ */
protected void addDefinition(String name, Class c) throws BuildException { protected void addDefinition(String name, Class c) throws BuildException {
project.addTaskDefinition(name, c);
getProject().addTaskDefinition(name, c);
} }
} }

+ 2
- 6
src/main/org/apache/tools/ant/taskdefs/TempFile.java View File

@@ -54,10 +54,6 @@
package org.apache.tools.ant.taskdefs; package org.apache.tools.ant.taskdefs;


import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.util.FileUtils;
@@ -155,10 +151,10 @@ public class TempFile extends Task {
throw new BuildException("no property specified"); throw new BuildException("no property specified");
} }
if (destDir == null) { if (destDir == null) {
destDir = project.resolveFile(".");
destDir = getProject().resolveFile(".");
} }
FileUtils utils = FileUtils.newFileUtils(); FileUtils utils = FileUtils.newFileUtils();
File tfile = utils.createTempFile(prefix, suffix, destDir); File tfile = utils.createTempFile(prefix, suffix, destDir);
project.setNewProperty(property, tfile.toString());
getProject().setNewProperty(property, tfile.toString());
} }
} }

+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/Touch.java View File

@@ -210,8 +210,8 @@ public class Touch extends Task {
// deal with the filesets // deal with the filesets
for (int i = 0; i < filesets.size(); i++) { for (int i = 0; i < filesets.size(); i++) {
FileSet fs = (FileSet) filesets.elementAt(i); FileSet fs = (FileSet) filesets.elementAt(i);
DirectoryScanner ds = fs.getDirectoryScanner(project);
File fromDir = fs.getDir(project);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
File fromDir = fs.getDir(getProject());


String[] srcFiles = ds.getIncludedFiles(); String[] srcFiles = ds.getIncludedFiles();
String[] srcDirs = ds.getIncludedDirectories(); String[] srcDirs = ds.getIncludedDirectories();


+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/Tstamp.java View File

@@ -112,18 +112,18 @@ public class Tstamp extends Task {
Enumeration i = customFormats.elements(); Enumeration i = customFormats.elements();
while (i.hasMoreElements()) { while (i.hasMoreElements()) {
CustomFormat cts = (CustomFormat) i.nextElement(); CustomFormat cts = (CustomFormat) i.nextElement();
cts.execute(project, d, location);
cts.execute(getProject(), d, location);
} }


SimpleDateFormat dstamp = new SimpleDateFormat ("yyyyMMdd"); SimpleDateFormat dstamp = new SimpleDateFormat ("yyyyMMdd");
project.setNewProperty(prefix + "DSTAMP", dstamp.format(d));
getProject().setNewProperty(prefix + "DSTAMP", dstamp.format(d));


SimpleDateFormat tstamp = new SimpleDateFormat ("HHmm"); SimpleDateFormat tstamp = new SimpleDateFormat ("HHmm");
project.setNewProperty(prefix + "TSTAMP", tstamp.format(d));
getProject().setNewProperty(prefix + "TSTAMP", tstamp.format(d));


SimpleDateFormat today SimpleDateFormat today
= new SimpleDateFormat ("MMMM d yyyy", Locale.US); = new SimpleDateFormat ("MMMM d yyyy", Locale.US);
project.setNewProperty(prefix + "TODAY", today.format(d));
getProject().setNewProperty(prefix + "TODAY", today.format(d));


} catch (Exception e) { } catch (Exception e) {
throw new BuildException(e); throw new BuildException(e);


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/Typedef.java View File

@@ -84,6 +84,6 @@ public class Typedef extends Definer {
* implement abstract callback of parent class * implement abstract callback of parent class
*/ */
protected void addDefinition(String name, Class c) throws BuildException { protected void addDefinition(String name, Class c) throws BuildException {
project.addDataTypeDefinition(name, c);
getProject().addDataTypeDefinition(name, c);
} }
} }

+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/Unpack.java View File

@@ -82,7 +82,7 @@ public abstract class Unpack extends Task {
public void setSrc(String src) { public void setSrc(String src) {
log("DEPRECATED - The setSrc(String) method has been deprecated." log("DEPRECATED - The setSrc(String) method has been deprecated."
+ " Use setSrc(File) instead."); + " Use setSrc(File) instead.");
setSrc(project.resolveFile(src));
setSrc(getProject().resolveFile(src));
} }


/** /**
@@ -95,7 +95,7 @@ public abstract class Unpack extends Task {
public void setDest(String dest) { public void setDest(String dest) {
log("DEPRECATED - The setDest(String) method has been deprecated." log("DEPRECATED - The setDest(String) method has been deprecated."
+ " Use setDest(File) instead."); + " Use setDest(File) instead.");
setDest(project.resolveFile(dest));
setDest(getProject().resolveFile(dest));
} }


/** /**


+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/UpToDate.java View File

@@ -156,7 +156,7 @@ public class UpToDate extends Task implements Condition {
throw new BuildException("Cannot define more than one mapper", throw new BuildException("Cannot define more than one mapper",
location); location);
} }
mapperElement = new Mapper(project);
mapperElement = new Mapper(getProject());
return mapperElement; return mapperElement;
} }


@@ -196,8 +196,8 @@ public class UpToDate extends Task implements Condition {
boolean upToDate = true; boolean upToDate = true;
while (upToDate && enum.hasMoreElements()) { while (upToDate && enum.hasMoreElements()) {
FileSet fs = (FileSet) enum.nextElement(); FileSet fs = (FileSet) enum.nextElement();
DirectoryScanner ds = fs.getDirectoryScanner(project);
upToDate = upToDate && scanDir(fs.getDir(project),
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
upToDate = upToDate && scanDir(fs.getDir(getProject()),
ds.getIncludedFiles()); ds.getIncludedFiles());
} }


@@ -229,7 +229,7 @@ public class UpToDate extends Task implements Condition {
} }
boolean upToDate = eval(); boolean upToDate = eval();
if (upToDate) { if (upToDate) {
this.project.setNewProperty(_property, getValue());
this.getProject().setNewProperty(_property, getValue());
if (mapperElement == null) { if (mapperElement == null) {
log("File \"" + _targetFile.getAbsolutePath() log("File \"" + _targetFile.getAbsolutePath()
+ "\" is up-to-date.", Project.MSG_VERBOSE); + "\" is up-to-date.", Project.MSG_VERBOSE);


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/WaitFor.java View File

@@ -164,7 +164,7 @@ public class WaitFor extends ConditionBase {
} }


if (timeoutProperty != null) { if (timeoutProperty != null) {
project.setNewProperty(timeoutProperty, "true");
getProject().setNewProperty(timeoutProperty, "true");
} }
} finally { } finally {
maxWaitMillis = savedMaxWaitMillis; maxWaitMillis = savedMaxWaitMillis;
@@ -175,7 +175,7 @@ public class WaitFor extends ConditionBase {
/** /**
* The enumeration of units: * The enumeration of units:
* millisecond, second, minute, hour, day, week * millisecond, second, minute, hour, day, week
* @todo: we use timestamps in many places, why not factor this out
* @todo we use timestamps in many places, why not factor this out
*/ */
public static class Unit extends EnumeratedAttribute { public static class Unit extends EnumeratedAttribute {




+ 6
- 6
src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java View File

@@ -193,7 +193,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {


try { try {
if (baseDir == null) { if (baseDir == null) {
baseDir = project.resolveFile(".");
baseDir = getProject().resolveFile(".");
} }


liaison = getLiaison(); liaison = getLiaison();
@@ -205,7 +205,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {


log("Using " + liaison.getClass().toString(), Project.MSG_VERBOSE); log("Using " + liaison.getClass().toString(), Project.MSG_VERBOSE);


File stylesheet = project.resolveFile(xslFile);
File stylesheet = getProject().resolveFile(xslFile);
if (!stylesheet.exists()) { if (!stylesheet.exists()) {
stylesheet = fileUtils.resolveFile(baseDir, xslFile); stylesheet = fileUtils.resolveFile(baseDir, xslFile);
/* /*
@@ -326,7 +326,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*/ */
public Path createClasspath() { public Path createClasspath() {
if (classpath == null) { if (classpath == null) {
classpath = new Path(project);
classpath = new Path(getProject());
} }
return classpath.createPath(); return classpath.createPath();
} }
@@ -398,7 +398,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
if (classpath == null) { if (classpath == null) {
return Class.forName(classname); return Class.forName(classname);
} else { } else {
AntClassLoader al = new AntClassLoader(project, classpath);
AntClassLoader al = new AntClassLoader(getProject(), classpath);
Class c = al.loadClass(classname); Class c = al.loadClass(classname);
AntClassLoader.initializeClass(c); AntClassLoader.initializeClass(c);
return c; return c;
@@ -702,7 +702,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {
*/ */
public void init() throws BuildException { public void init() throws BuildException {
super.init(); super.init();
xmlCatalog.setProject(project);
xmlCatalog.setProject(getProject());
} }


/** /**
@@ -810,7 +810,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger {


/** /**
* Create an instance of a factory attribute. * Create an instance of a factory attribute.
* @return the newly created factory attribute
* the newly created factory attribute
*/ */
public void addAttribute(Attribute attr) { public void addAttribute(Attribute attr) {
attributes.addElement(attr); attributes.addElement(attr);


+ 2
- 5
src/main/org/apache/tools/ant/taskdefs/XmlProperty.java View File

@@ -63,13 +63,11 @@ import org.xml.sax.SAXException;


import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.util.Vector;


/** /**
* Loads property values from a valid XML file, * Loads property values from a valid XML file,
@@ -91,7 +89,6 @@ import java.util.Vector;
* </pre> * </pre>
* @author <a href="mailto:nicolaken@apache.org">Nicola Ken Barozzi</a> * @author <a href="mailto:nicolaken@apache.org">Nicola Ken Barozzi</a>
* @author Erik Hatcher * @author Erik Hatcher
* @created 14 January 2002
* @ant.task name="xmlproperty" category="xml" * @ant.task name="xmlproperty" category="xml"
*/ */


@@ -201,7 +198,7 @@ public class XmlProperty extends org.apache.tools.ant.Task {


String attributeValue = attributeNode.getNodeValue(); String attributeValue = attributeNode.getNodeValue();
log(attributeName + ":" + attributeValue, Project.MSG_DEBUG); log(attributeName + ":" + attributeValue, Project.MSG_DEBUG);
project.setNewProperty(attributeName, attributeValue);
getProject().setNewProperty(attributeName, attributeValue);
} }
} }


@@ -209,7 +206,7 @@ public class XmlProperty extends org.apache.tools.ant.Task {
String nodeText = node.getNodeValue(); String nodeText = node.getNodeValue();
if (nodeText.trim().length() != 0) { if (nodeText.trim().length() != 0) {
log(prefix + ":" + nodeText, Project.MSG_DEBUG); log(prefix + ":" + nodeText, Project.MSG_DEBUG);
project.setNewProperty(prefix, nodeText);
getProject().setNewProperty(prefix, nodeText);
} }
} }




+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/Zip.java View File

@@ -298,7 +298,7 @@ public class Zip extends MatchingTask {


log("Processing groupfileset ", Project.MSG_VERBOSE); log("Processing groupfileset ", Project.MSG_VERBOSE);
FileSet fs = (FileSet) groupfilesets.elementAt(i); FileSet fs = (FileSet) groupfilesets.elementAt(i);
FileScanner scanner = fs.getDirectoryScanner(project);
FileScanner scanner = fs.getDirectoryScanner(getProject());
String[] files = scanner.getIncludedFiles(); String[] files = scanner.getIncludedFiles();
File basedir = scanner.getBasedir(); File basedir = scanner.getBasedir();
for (int j = 0; j < files.length; j++) { for (int j = 0; j < files.length; j++) {
@@ -319,7 +319,7 @@ public class Zip extends MatchingTask {
} }
for (int i = 0; i < filesets.size(); i++) { for (int i = 0; i < filesets.size(); i++) {
FileSet fs = (FileSet) filesets.elementAt(i); FileSet fs = (FileSet) filesets.elementAt(i);
dss.addElement (fs.getDirectoryScanner(project));
dss.addElement (fs.getDirectoryScanner(getProject()));
} }
int dssSize = dss.size(); int dssSize = dss.size();
FileScanner[] scanners = new FileScanner[dssSize]; FileScanner[] scanners = new FileScanner[dssSize];
@@ -845,7 +845,7 @@ public class Zip extends MatchingTask {
// Add each fileset in the Vector. // Add each fileset in the Vector.
for (int i = 0; i < filesets.size(); i++) { for (int i = 0; i < filesets.size(); i++) {
FileSet fs = (FileSet) filesets.elementAt(i); FileSet fs = (FileSet) filesets.elementAt(i);
DirectoryScanner ds = fs.getDirectoryScanner(project);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());


String prefix = ""; String prefix = "";
String fullpath = ""; String fullpath = "";


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java View File

@@ -262,7 +262,7 @@ public class ChangeLogTask extends Task {
while (e.hasMoreElements()) { while (e.hasMoreElements()) {
final FileSet fileSet = (FileSet) e.nextElement(); final FileSet fileSet = (FileSet) e.nextElement();
final DirectoryScanner scanner = final DirectoryScanner scanner =
fileSet.getDirectoryScanner(project);
fileSet.getDirectoryScanner(getProject());
final String[] files = scanner.getIncludedFiles(); final String[] files = scanner.getIncludedFiles();


for (int i = 0; i < files.length; i++) { for (int i = 0; i < files.length; i++) {


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java View File

@@ -353,7 +353,7 @@ public class EmailTask
StringTokenizer t = new StringTokenizer(filenames, ", "); StringTokenizer t = new StringTokenizer(filenames, ", ");


while (t.hasMoreTokens()) { while (t.hasMoreTokens()) {
files.addElement(project.resolveFile(t.nextToken()));
files.addElement(getProject().resolveFile(t.nextToken()));
} }
} }


@@ -475,7 +475,7 @@ public class EmailTask
while (e.hasMoreElements()) { while (e.hasMoreElements()) {
FileSet fs = (FileSet) e.nextElement(); FileSet fs = (FileSet) e.nextElement();


DirectoryScanner ds = fs.getDirectoryScanner(project);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
String[] includedFiles = ds.getIncludedFiles(); String[] includedFiles = ds.getIncludedFiles();
File baseDir = ds.getBasedir(); File baseDir = ds.getBasedir();




+ 3
- 10
src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java View File

@@ -89,9 +89,6 @@ public class ANTLR extends Task {
/** an optional super grammar file */ /** an optional super grammar file */
private String superGrammar; private String superGrammar;


/** optional flag to enable parseView debugging */
private boolean debug;

/** optional flag to enable html output */ /** optional flag to enable html output */
private boolean html; private boolean html;


@@ -110,9 +107,6 @@ public class ANTLR extends Task {
/** optional flag to add trace methods to the tree walker only */ /** optional flag to add trace methods to the tree walker only */
private boolean traceTreeWalker; private boolean traceTreeWalker;


/** should fork ? */
private final boolean fork = true;

/** working directory */ /** working directory */
private File workingdir = null; private File workingdir = null;


@@ -148,7 +142,7 @@ public class ANTLR extends Task {
* Sets a flag to enable ParseView debugging * Sets a flag to enable ParseView debugging
*/ */
public void setDebug(boolean enable) { public void setDebug(boolean enable) {
debug = enable;
log( "debug attribute is never used", Project.MSG_WARN);
} }


/** /**
@@ -216,7 +210,7 @@ public class ANTLR extends Task {
* because a directory might be given for Antlr debug. * because a directory might be given for Antlr debug.
*/ */
public Path createClasspath() { public Path createClasspath() {
return commandline.createClasspath(project).createPath();
return commandline.createClasspath(getProject()).createPath();
} }


/** /**
@@ -329,7 +323,6 @@ public class ANTLR extends Task {


// if no output directory is specified, used the target's directory // if no output directory is specified, used the target's directory
if (outputDirectory == null) { if (outputDirectory == null) {
String fileName = target.toString();
setOutputdirectory(new File(target.getParent())); setOutputdirectory(new File(target.getParent()));
} }
if (!outputDirectory.isDirectory()) { if (!outputDirectory.isDirectory()) {
@@ -363,7 +356,7 @@ public class ANTLR extends Task {
private int run(String[] command) throws BuildException { private int run(String[] command) throws BuildException {
Execute exe = new Execute(new LogStreamHandler(this, Project.MSG_INFO, Execute exe = new Execute(new LogStreamHandler(this, Project.MSG_INFO,
Project.MSG_WARN), null); Project.MSG_WARN), null);
exe.setAntRun(project);
exe.setAntRun(getProject());
if (workingdir != null) { if (workingdir != null) {
exe.setWorkingDirectory(workingdir); exe.setWorkingDirectory(workingdir);
} }


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/Cab.java View File

@@ -159,7 +159,7 @@ public class Cab extends MatchingTask {
* it appears in the logs to be the same task as this one. * it appears in the logs to be the same task as this one.
*/ */
protected ExecTask createExec() throws BuildException { protected ExecTask createExec() throws BuildException {
ExecTask exec = (ExecTask) project.createTask("exec");
ExecTask exec = (ExecTask) getProject().createTask("exec");
exec.setOwningTarget(this.getOwningTarget()); exec.setOwningTarget(this.getOwningTarget());
exec.setTaskName(this.getTaskName()); exec.setTaskName(this.getTaskName());
exec.setDescription(this.getDescription()); exec.setDescription(this.getDescription());
@@ -253,7 +253,7 @@ public class Cab extends MatchingTask {
for (int i = 0; i < filesets.size(); i++) { for (int i = 0; i < filesets.size(); i++) {
FileSet fs = (FileSet) filesets.elementAt(i); FileSet fs = (FileSet) filesets.elementAt(i);
if (fs != null) { if (fs != null) {
appendFiles(files, fs.getDirectoryScanner(project));
appendFiles(files, fs.getDirectoryScanner(getProject()));
} }
} }
} }


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java View File

@@ -243,7 +243,7 @@ public class EchoProperties extends Task {
use Ant's properties */ use Ant's properties */
if(inFile == null) { if(inFile == null) {
// add ant properties // add ant properties
CollectionUtils.putAll(allProps, project.getProperties());
CollectionUtils.putAll(allProps, getProject().getProperties());
} else { } else {
if (inFile.exists() && inFile.isDirectory()) { if (inFile.exists() && inFile.isDirectory()) {
String message = "srcfile is a directory!"; String message = "srcfile is a directory!";


+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/optional/IContract.java View File

@@ -536,7 +536,7 @@ public class IContract extends MatchingTask {
// Prepare the directories for iContract. iContract will make them if they // 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 // don't exist, but for some reason I don't know, it will complain about the REP files
// afterwards // afterwards
Mkdir mkdir = (Mkdir) project.createTask("mkdir");
Mkdir mkdir = (Mkdir) getProject().createTask("mkdir");


mkdir.setDir(instrumentDir); mkdir.setDir(instrumentDir);
mkdir.execute(); mkdir.execute();
@@ -549,7 +549,7 @@ public class IContract extends MatchingTask {
Path baseClasspath = createClasspath(); Path baseClasspath = createClasspath();


// Might need to add the core classes if we're not using Sun's Javac (like Jikes) // Might need to add the core classes if we're not using Sun's Javac (like Jikes)
String compiler = project.getProperty("build.compiler");
String compiler = getProject().getProperty("build.compiler");
ClasspathHelper classpathHelper = new ClasspathHelper(compiler); ClasspathHelper classpathHelper = new ClasspathHelper(compiler);


classpathHelper.modify(baseClasspath); classpathHelper.modify(baseClasspath);
@@ -586,7 +586,7 @@ public class IContract extends MatchingTask {
iContractClasspath.append(new Path(getProject(), buildDir.getAbsolutePath())); iContractClasspath.append(new Path(getProject(), buildDir.getAbsolutePath()));


// Create a forked java process // Create a forked java process
Java iContract = (Java) project.createTask("java");
Java iContract = (Java) getProject().createTask("java");


iContract.setTaskName(getTaskName()); iContract.setTaskName(getTaskName());
iContract.setFork(true); iContract.setFork(true);


+ 3
- 5
src/main/org/apache/tools/ant/taskdefs/optional/Javah.java View File

@@ -104,8 +104,6 @@ import java.util.Enumeration;


public class Javah extends Task { public class Javah extends Task {


private static final String FAIL_MSG = "Compile failed, messages should have been provided.";

private Vector classes = new Vector(2); private Vector classes = new Vector(2);
private String cls; private String cls;
private File destDir; private File destDir;
@@ -175,7 +173,7 @@ public class Javah extends Task {
*/ */
public Path createClasspath() { public Path createClasspath() {
if (classpath == null) { if (classpath == null) {
classpath = new Path(project);
classpath = new Path(getProject());
} }
return classpath.createPath(); return classpath.createPath();
} }
@@ -204,7 +202,7 @@ public class Javah extends Task {
*/ */
public Path createBootclasspath() { public Path createBootclasspath() {
if (bootclasspath == null) { if (bootclasspath == null) {
bootclasspath = new Path(project);
bootclasspath = new Path(getProject());
} }
return bootclasspath.createPath(); return bootclasspath.createPath();
} }
@@ -305,7 +303,7 @@ public class Javah extends Task {
classpath = Path.systemClasspath; classpath = Path.systemClasspath;
} }


String compiler = project.getProperty("build.compiler");
String compiler = getProject().getProperty("build.compiler");
if (compiler == null) { if (compiler == null) {
if (!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1) && if (!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1) &&
!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2)) { !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2)) {


+ 2
- 3
src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java View File

@@ -142,19 +142,18 @@ public class Native2Ascii extends MatchingTask {
throw new BuildException("Cannot define more than one mapper", throw new BuildException("Cannot define more than one mapper",
location); location);
} }
mapper = new Mapper(project);
mapper = new Mapper(getProject());
return mapper; return mapper;
} }


public void execute() throws BuildException { public void execute() throws BuildException {


Commandline baseCmd = null; // the common portion of our cmd line
DirectoryScanner scanner = null; // Scanner to find our inputs DirectoryScanner scanner = null; // Scanner to find our inputs
String[] files; // list of files to process String[] files; // list of files to process


// default srcDir to basedir // default srcDir to basedir
if (srcDir == null){ if (srcDir == null){
srcDir = project.resolveFile(".");
srcDir = getProject().resolveFile(".");
} }


// Require destDir // Require destDir


+ 35
- 39
src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java View File

@@ -140,7 +140,6 @@ public class NetRexxC extends MatchingTask {
private boolean diag; private boolean diag;
private boolean explicit; private boolean explicit;
private boolean format; private boolean format;
private boolean java;
private boolean keep; private boolean keep;
private boolean logo = true; private boolean logo = true;
private boolean replace; private boolean replace;
@@ -174,8 +173,6 @@ public class NetRexxC extends MatchingTask {
// other implementation variables // other implementation variables
private Vector compileList = new Vector(); private Vector compileList = new Vector();
private Hashtable filecopyList = new Hashtable(); private Hashtable filecopyList = new Hashtable();
private String oldClasspath = System.getProperty("java.class.path");



/** /**
* Set whether literals are treated as binary, rather than NetRexx types * Set whether literals are treated as binary, rather than NetRexx types
@@ -294,7 +291,7 @@ public class NetRexxC extends MatchingTask {
* false. * false.
*/ */
public void setJava(boolean java) { public void setJava(boolean java) {
this.java = java;
log( "The attribute java is currently unused.", Project.MSG_WARN );
} }




@@ -535,103 +532,103 @@ public class NetRexxC extends MatchingTask {
public void init() { public void init() {
String p; String p;


if ((p = project.getProperty("ant.netrexxc.binary")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.binary")) != null) {
this.binary = Project.toBoolean(p); this.binary = Project.toBoolean(p);
} }
// classpath makes no sense // classpath makes no sense
if ((p = project.getProperty("ant.netrexxc.comments")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.comments")) != null) {
this.comments = Project.toBoolean(p); this.comments = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.compact")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.compact")) != null) {
this.compact = Project.toBoolean(p); this.compact = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.compile")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.compile")) != null) {
this.compile = Project.toBoolean(p); this.compile = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.console")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.console")) != null) {
this.console = Project.toBoolean(p); this.console = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.crossref")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.crossref")) != null) {
this.crossref = Project.toBoolean(p); this.crossref = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.decimal")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.decimal")) != null) {
this.decimal = Project.toBoolean(p); this.decimal = Project.toBoolean(p);
// destDir // destDir
} }
if ((p = project.getProperty("ant.netrexxc.diag")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.diag")) != null) {
this.diag = Project.toBoolean(p); this.diag = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.explicit")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.explicit")) != null) {
this.explicit = Project.toBoolean(p); this.explicit = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.format")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.format")) != null) {
this.format = Project.toBoolean(p); this.format = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.java")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.java")) != null) {
this.java = Project.toBoolean(p); this.java = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.keep")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.keep")) != null) {
this.keep = Project.toBoolean(p); this.keep = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.logo")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.logo")) != null) {
this.logo = Project.toBoolean(p); this.logo = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.replace")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.replace")) != null) {
this.replace = Project.toBoolean(p); this.replace = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.savelog")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.savelog")) != null) {
this.savelog = Project.toBoolean(p); this.savelog = Project.toBoolean(p);
// srcDir // srcDir
} }
if ((p = project.getProperty("ant.netrexxc.sourcedir")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.sourcedir")) != null) {
this.sourcedir = Project.toBoolean(p); this.sourcedir = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.strictargs")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.strictargs")) != null) {
this.strictargs = Project.toBoolean(p); this.strictargs = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.strictassign")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.strictassign")) != null) {
this.strictassign = Project.toBoolean(p); this.strictassign = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.strictcase")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.strictcase")) != null) {
this.strictcase = Project.toBoolean(p); this.strictcase = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.strictimport")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.strictimport")) != null) {
this.strictimport = Project.toBoolean(p); this.strictimport = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.strictprops")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.strictprops")) != null) {
this.strictprops = Project.toBoolean(p); this.strictprops = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.strictsignal")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.strictsignal")) != null) {
this.strictsignal = Project.toBoolean(p); this.strictsignal = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.symbols")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.symbols")) != null) {
this.symbols = Project.toBoolean(p); this.symbols = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.time")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.time")) != null) {
this.time = Project.toBoolean(p); this.time = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.trace")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.trace")) != null) {
setTrace(p); setTrace(p);
} }
if ((p = project.getProperty("ant.netrexxc.utf8")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.utf8")) != null) {
this.utf8 = Project.toBoolean(p); this.utf8 = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.verbose")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.verbose")) != null) {
setVerbose(p); setVerbose(p);
} }
if ((p = project.getProperty("ant.netrexxc.suppressMethodArgumentNotUsed")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.suppressMethodArgumentNotUsed")) != null) {
this.suppressMethodArgumentNotUsed = Project.toBoolean(p); this.suppressMethodArgumentNotUsed = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.suppressPrivatePropertyNotUsed")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.suppressPrivatePropertyNotUsed")) != null) {
this.suppressPrivatePropertyNotUsed = Project.toBoolean(p); this.suppressPrivatePropertyNotUsed = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.suppressVariableNotUsed")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.suppressVariableNotUsed")) != null) {
this.suppressVariableNotUsed = Project.toBoolean(p); this.suppressVariableNotUsed = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.suppressExceptionNotSignalled")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.suppressExceptionNotSignalled")) != null) {
this.suppressExceptionNotSignalled = Project.toBoolean(p); this.suppressExceptionNotSignalled = Project.toBoolean(p);
} }
if ((p = project.getProperty("ant.netrexxc.suppressDeprecation")) != null) {
if ((p = getProject().getProperty("ant.netrexxc.suppressDeprecation")) != null) {
this.suppressDeprecation = Project.toBoolean(p); this.suppressDeprecation = Project.toBoolean(p);
} }
} }
@@ -712,7 +709,7 @@ public class NetRexxC extends MatchingTask {
String toFile = (String) filecopyList.get(fromFile); String toFile = (String) filecopyList.get(fromFile);


try { try {
project.copyFile(fromFile, toFile);
getProject().copyFile(fromFile, toFile);
} catch (IOException ioe) { } catch (IOException ioe) {
String msg = "Failed to copy " + fromFile + " to " + toFile String msg = "Failed to copy " + fromFile + " to " + toFile
+ " due to " + ioe.getMessage(); + " due to " + ioe.getMessage();
@@ -730,7 +727,6 @@ public class NetRexxC extends MatchingTask {


String classpath = getCompileClasspath(); String classpath = getCompileClasspath();
StringBuffer compileOptions = new StringBuffer(); StringBuffer compileOptions = new StringBuffer();
StringBuffer fileList = new StringBuffer();


// create an array of strings for input to the compiler: one array // create an array of strings for input to the compiler: one array
// comes from the compile options, the other from the compileList // comes from the compile options, the other from the compileList
@@ -904,7 +900,7 @@ public class NetRexxC extends MatchingTask {
System.getProperty("path.separator"), false); System.getProperty("path.separator"), false);


while (tok.hasMoreTokens()) { while (tok.hasMoreTokens()) {
File f = project.resolveFile(tok.nextToken());
File f = getProject().resolveFile(tok.nextToken());


if (f.exists()) { if (f.exists()) {
target.append(File.pathSeparator); target.append(File.pathSeparator);


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/RenameExtensions.java View File

@@ -151,7 +151,7 @@ public class RenameExtensions extends MatchingTask {
log("using the same patterns on <fileset> as you\'ve used here", log("using the same patterns on <fileset> as you\'ve used here",
Project.MSG_INFO); Project.MSG_INFO);


Move move = (Move) project.createTask("move");
Move move = (Move) getProject().createTask("move");
move.setOwningTarget(target); move.setOwningTarget(target);
move.setTaskName(getTaskName()); move.setTaskName(getTaskName());
move.setLocation(getLocation()); move.setLocation(getLocation());


+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java View File

@@ -285,10 +285,10 @@ public class ReplaceRegExp extends Task {
String input, String input,
int options) { int options) {
String res = input; String res = input;
Regexp regexp = r.getRegexp(project);
Regexp regexp = r.getRegexp(getProject());


if (regexp.matches(input, options)) { if (regexp.matches(input, options)) {
res = regexp.substitute(input, s.getExpression(project), options);
res = regexp.substitute(input, s.getExpression(getProject()), options);
} }


return res; return res;
@@ -314,8 +314,8 @@ public class ReplaceRegExp extends Task {


boolean changes = false; boolean changes = false;


log("Replacing pattern '" + regex.getPattern(project) +
"' with '" + subs.getExpression(project) +
log("Replacing pattern '" + regex.getPattern(getProject()) +
"' with '" + subs.getExpression(getProject()) +
"' in '" + f.getPath() + "'" + "' in '" + f.getPath() + "'" +
(byline ? " by line" : "") + (byline ? " by line" : "") +
(flags.length() > 0 ? " with flags: '" + flags + "'" : "") + (flags.length() > 0 ? " with flags: '" + flags + "'" : "") +


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java View File

@@ -169,9 +169,9 @@ public class Rpm extends Task {


Execute exe = new Execute(streamhandler, null); Execute exe = new Execute(streamhandler, null);


exe.setAntRun(project);
exe.setAntRun(getProject());
if (topDir == null) { if (topDir == null) {
topDir = project.getBaseDir();
topDir = getProject().getBaseDir();
} }
exe.setWorkingDirectory(topDir); exe.setWorkingDirectory(topDir);




+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/optional/Script.java View File

@@ -111,10 +111,10 @@ public class Script extends Task {
*/ */
public void execute() throws BuildException { public void execute() throws BuildException {
try { try {
addBeans(project.getProperties());
addBeans(project.getUserProperties());
addBeans(project.getTargets());
addBeans(project.getReferences());
addBeans(getProject().getProperties());
addBeans(getProject().getUserProperties());
addBeans(getProject().getTargets());
addBeans(getProject().getReferences());


beans.put("project", getProject()); beans.put("project", getProject());




+ 6
- 9
src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java View File

@@ -56,9 +56,6 @@ package org.apache.tools.ant.taskdefs.optional;
import java.io.File; import java.io.File;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.Vector; import java.util.Vector;
@@ -163,7 +160,7 @@ public class XMLValidateTask extends Task {
* or SAX2 <code>org.xml.sax.Parser</code>. * or SAX2 <code>org.xml.sax.Parser</code>.
* <p> if className is an implementation of <code>org.xml.sax.Parser</code>, {@link #setLenient(boolean)}, * <p> if className is an implementation of <code>org.xml.sax.Parser</code>, {@link #setLenient(boolean)},
* will be ignored. * will be ignored.
* <p> if not set, the default {@link #DEFAULT_XML_READER_CLASSNAME} will be used.
* <p> if not set, the default will be used.
* @see org.xml.sax.XMLReader * @see org.xml.sax.XMLReader
* @see org.xml.sax.Parser * @see org.xml.sax.Parser
*/ */
@@ -190,7 +187,7 @@ public class XMLValidateTask extends Task {
*/ */
public Path createClasspath() { public Path createClasspath() {
if (this.classpath == null) { if (this.classpath == null) {
this.classpath = new Path(project);
this.classpath = new Path(getProject());
} }
return this.classpath.createPath(); return this.classpath.createPath();
} }
@@ -226,7 +223,7 @@ public class XMLValidateTask extends Task {


public void init() throws BuildException { public void init() throws BuildException {
super.init(); super.init();
xmlCatalog.setProject(project);
xmlCatalog.setProject(getProject());
} }


/** /**
@@ -270,11 +267,11 @@ public class XMLValidateTask extends Task {
for (int i = 0; i < filesets.size(); i++) { for (int i = 0; i < filesets.size(); i++) {


FileSet fs = (FileSet) filesets.elementAt(i); FileSet fs = (FileSet) filesets.elementAt(i);
DirectoryScanner ds = fs.getDirectoryScanner(project);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
String[] files = ds.getIncludedFiles(); String[] files = ds.getIncludedFiles();


for (int j = 0; j < files.length ; j++) { for (int j = 0; j < files.length ; j++) {
File srcFile = new File(fs.getDir(project), files[j]);
File srcFile = new File(fs.getDir(getProject()), files[j]);
doValidate(srcFile); doValidate(srcFile);
fileProcessed++; fileProcessed++;
} }
@@ -301,7 +298,7 @@ public class XMLValidateTask extends Task {
try { try {
// load the parser class // load the parser class
if (classpath != null) { if (classpath != null) {
AntClassLoader loader = new AntClassLoader(project, classpath);
AntClassLoader loader = new AntClassLoader(getProject(), classpath);
readerClass = loader.loadClass(readerClassName); readerClass = loader.loadClass(readerClassName);
AntClassLoader.initializeClass(readerClass); AntClassLoader.initializeClass(readerClass);
} else { } else {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java View File

@@ -103,7 +103,7 @@ public abstract class Continuus extends Task {
* @param dir the directory containing the ccm executable * @param dir the directory containing the ccm executable
*/ */
public final void setCcmDir(String dir) { public final void setCcmDir(String dir) {
ccmDir = project.translatePath(dir);
ccmDir = getProject().translatePath(dir);
} }


/** /**


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java View File

@@ -87,7 +87,7 @@ public abstract class ClearCase extends Task {
* @param dir the directory containing the cleartool executable * @param dir the directory containing the cleartool executable
*/ */
public final void setClearToolDir(String dir) { public final void setClearToolDir(String dir) {
m_ClearToolDir = project.translatePath(dir);
m_ClearToolDir = getProject().translatePath(dir);
} }


/** /**


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/depend/Depend.java View File

@@ -179,7 +179,7 @@ public class Depend extends MatchingTask {
*/ */
public Path createClasspath() { public Path createClasspath() {
if (dependClasspath == null) { if (dependClasspath == null) {
dependClasspath = new Path(project);
dependClasspath = new Path(getProject());
} }
return dependClasspath.createPath(); return dependClasspath.createPath();
} }
@@ -588,7 +588,7 @@ public class Depend extends MatchingTask {
private void determineOutOfDateClasses() { private void determineOutOfDateClasses() {
outOfDateClasses = new Hashtable(); outOfDateClasses = new Hashtable();
for (int i = 0; i < srcPathList.length; i++) { for (int i = 0; i < srcPathList.length; i++) {
File srcDir = (File) project.resolveFile(srcPathList[i]);
File srcDir = (File) getProject().resolveFile(srcPathList[i]);
if (srcDir.exists()) { if (srcDir.exists()) {
DirectoryScanner ds = this.getDirectoryScanner(srcDir); DirectoryScanner ds = this.getDirectoryScanner(srcDir);
String[] files = ds.getIncludedFiles(); String[] files = ds.getIncludedFiles();


+ 3
- 11
src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java View File

@@ -315,12 +315,6 @@ public class CSharp
*/ */
private File srcDir; private File srcDir;


/**
* destination directory (null means use the source directory) NB: this is
* currently not used
*/
private File destDir;

/** /**
* type of target. Should be one of exe|library|module|winexe|(null) * type of target. Should be one of exe|library|module|winexe|(null)
* default is exe; the actual value (if not null) is fed to the command * default is exe; the actual value (if not null) is fed to the command
@@ -389,7 +383,7 @@ public class CSharp
public void setReferenceFiles(Path path) { public void setReferenceFiles(Path path) {
//demand create pathlist //demand create pathlist
if (referenceFiles == null) { if (referenceFiles == null) {
referenceFiles = new Path(this.project);
referenceFiles = new Path(this.getProject());
} }
referenceFiles.append(path); referenceFiles.append(path);
} }
@@ -734,7 +728,7 @@ public class CSharp
*@param dirName The new DestDir value *@param dirName The new DestDir value
*/ */
public void setDestDir(File dirName) { public void setDestDir(File dirName) {
this.destDir = dirName;
log( "DestDir currently unused", Project.MSG_WARN );
} }




@@ -1021,7 +1015,6 @@ public class CSharp
targetType = null; targetType = null;
win32icon = null; win32icon = null;
srcDir = null; srcDir = null;
destDir = null;
mainClass = null; mainClass = null;
unsafe = false; unsafe = false;
warnLevel = 3; warnLevel = 3;
@@ -1069,7 +1062,7 @@ public class CSharp
public void execute() public void execute()
throws BuildException { throws BuildException {
if (srcDir == null) { if (srcDir == null) {
srcDir = project.resolveFile(".");
srcDir = getProject().resolveFile(".");
} }
log("CSC working from source directory " + srcDir, Project.MSG_VERBOSE); log("CSC working from source directory " + srcDir, Project.MSG_VERBOSE);
validate(); validate();
@@ -1113,7 +1106,6 @@ public class CSharp
DirectoryScanner scanner = super.getDirectoryScanner(srcDir); DirectoryScanner scanner = super.getDirectoryScanner(srcDir);
String[] dependencies = scanner.getIncludedFiles(); String[] dependencies = scanner.getIncludedFiles();
log("compiling " + dependencies.length + " file" + ((dependencies.length == 1) ? "" : "s")); log("compiling " + dependencies.length + " file" + ((dependencies.length == 1) ? "" : "s"));
String baseDir = scanner.getBasedir().toString();
File base = scanner.getBasedir(); File base = scanner.getBasedir();
//add to the command //add to the command
for (int i = 0; i < dependencies.length; i++) { for (int i = 0; i < dependencies.length; i++) {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java View File

@@ -492,7 +492,7 @@ public class Ilasm
public void execute() public void execute()
throws BuildException { throws BuildException {
if (srcDir == null) { if (srcDir == null) {
srcDir = project.resolveFile(".");
srcDir = getProject().resolveFile(".");
} }


//get dependencies list. //get dependencies list.


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java View File

@@ -146,7 +146,7 @@ public class BorlandGenerateClient extends Task {
*/ */
public Path createClasspath() { public Path createClasspath() {
if (this.classpath == null) { if (this.classpath == null) {
this.classpath = new Path(project);
this.classpath = new Path(getProject());
} }
return this.classpath.createPath(); return this.classpath.createPath();
} }


+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java View File

@@ -125,14 +125,14 @@ public class DDCreator extends MatchingTask {
} }
String systemClassPath = System.getProperty("java.class.path"); String systemClassPath = System.getProperty("java.class.path");
String execClassPath = project.translatePath(systemClassPath + ":" + classpath);
Java ddCreatorTask = (Java) project.createTask("java");
String execClassPath = getProject().translatePath(systemClassPath + ":" + classpath);
Java ddCreatorTask = (Java) getProject().createTask("java");
ddCreatorTask.setTaskName(getTaskName()); ddCreatorTask.setTaskName(getTaskName());
ddCreatorTask.setFork(true); ddCreatorTask.setFork(true);
ddCreatorTask.setClassname("org.apache.tools.ant.taskdefs.optional.ejb.DDCreatorHelper"); ddCreatorTask.setClassname("org.apache.tools.ant.taskdefs.optional.ejb.DDCreatorHelper");
Commandline.Argument arguments = ddCreatorTask.createArg(); Commandline.Argument arguments = ddCreatorTask.createArg();
arguments.setLine(args); arguments.setLine(args);
ddCreatorTask.setClasspath(new Path(project, execClassPath));
ddCreatorTask.setClasspath(new Path(getProject(), execClassPath));
if (ddCreatorTask.executeJava() != 0) { if (ddCreatorTask.executeJava() != 0) {
throw new BuildException("Execution of ddcreator helper failed"); throw new BuildException("Execution of ddcreator helper failed");
} }
@@ -165,6 +165,6 @@ public class DDCreator extends MatchingTask {
* @param s the classpath to use for the ddcreator tool. * @param s the classpath to use for the ddcreator tool.
*/ */
public void setClasspath(String s) { public void setClasspath(String s) {
this.classpath = project.translatePath(s);
this.classpath = getProject().translatePath(s);
} }
} }

+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java View File

@@ -336,7 +336,7 @@ public class EjbJar extends MatchingTask {
*/ */
public Path createClasspath() { public Path createClasspath() {
if (config.classpath == null) { if (config.classpath == null) {
config.classpath = new Path(project);
config.classpath = new Path(getProject());
} }
return config.classpath.createPath(); return config.classpath.createPath();
} }


+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java View File

@@ -131,14 +131,14 @@ public class Ejbc extends MatchingTask {
} }


String systemClassPath = System.getProperty("java.class.path"); String systemClassPath = System.getProperty("java.class.path");
String execClassPath = project.translatePath(systemClassPath + ":" + classpath +
String execClassPath = getProject().translatePath(systemClassPath + ":" + classpath +
":" + generatedFilesDirectory); ":" + generatedFilesDirectory);
// get all the files in the descriptor directory // get all the files in the descriptor directory
DirectoryScanner ds = super.getDirectoryScanner(descriptorDirectory); DirectoryScanner ds = super.getDirectoryScanner(descriptorDirectory);


String[] files = ds.getIncludedFiles(); String[] files = ds.getIncludedFiles();


Java helperTask = (Java) project.createTask("java");
Java helperTask = (Java) getProject().createTask("java");
helperTask.setTaskName(getTaskName()); helperTask.setTaskName(getTaskName());
helperTask.setFork(true); helperTask.setFork(true);
helperTask.setClassname("org.apache.tools.ant.taskdefs.optional.ejb.EjbcHelper"); helperTask.setClassname("org.apache.tools.ant.taskdefs.optional.ejb.EjbcHelper");
@@ -155,7 +155,7 @@ public class Ejbc extends MatchingTask {


Commandline.Argument arguments = helperTask.createArg(); Commandline.Argument arguments = helperTask.createArg();
arguments.setLine(args); arguments.setLine(args);
helperTask.setClasspath(new Path(project, execClassPath));
helperTask.setClasspath(new Path(getProject(), execClassPath));
if (helperTask.executeJava() != 0) { if (helperTask.executeJava() != 0) {
throw new BuildException("Execution of ejbc helper failed"); throw new BuildException("Execution of ejbc helper failed");
} }
@@ -210,7 +210,7 @@ public class Ejbc extends MatchingTask {
* Set the classpath to be used for this compilation. * Set the classpath to be used for this compilation.
*/ */
public void setClasspath(String s) { public void setClasspath(String s) {
this.classpath = project.translatePath(s);
this.classpath = getProject().translatePath(s);
} }


/** /**


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbcTask.java View File

@@ -184,7 +184,7 @@ public class IPlanetEjbcTask extends Task {
*/ */
public Path createClasspath() { public Path createClasspath() {
if (classpath == null) { if (classpath == null) {
classpath = new Path(project);
classpath = new Path(getProject());
} }
return classpath.createPath(); return classpath.createPath();
} }


+ 6
- 6
src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLRun.java View File

@@ -149,7 +149,7 @@ public class WLRun extends Task {
*/ */
public Path createClasspath() { public Path createClasspath() {
if (classpath == null) { if (classpath == null) {
classpath = new Path(project);
classpath = new Path(getProject());
} }
return classpath.createPath(); return classpath.createPath();
} }
@@ -159,7 +159,7 @@ public class WLRun extends Task {
*/ */
public Path createWLClasspath() { public Path createWLClasspath() {
if (weblogicClasspath == null) { if (weblogicClasspath == null) {
weblogicClasspath = new Path(project);
weblogicClasspath = new Path(getProject());
} }
return weblogicClasspath.createPath(); return weblogicClasspath.createPath();
} }
@@ -200,7 +200,7 @@ public class WLRun extends Task {
// If an explicit securityPolicy file was specified, it maybe an // If an explicit securityPolicy file was specified, it maybe an
// absolute path. Use the project to resolve it. // absolute path. Use the project to resolve it.
if (this.securityPolicy != null && !securityPolicyFile.exists()) { if (this.securityPolicy != null && !securityPolicyFile.exists()) {
securityPolicyFile = project.resolveFile(securityPolicy);
securityPolicyFile = getProject().resolveFile(securityPolicy);
} }
// If we still can't find it, complain // If we still can't find it, complain
if (!securityPolicyFile.exists()) { if (!securityPolicyFile.exists()) {
@@ -229,7 +229,7 @@ public class WLRun extends Task {
throw new BuildException("You must supply a management password to start the server"); throw new BuildException("You must supply a management password to start the server");
} }


Java weblogicServer = (Java) project.createTask("java");
Java weblogicServer = (Java) getProject().createTask("java");
weblogicServer.setTaskName(getTaskName()); weblogicServer.setTaskName(getTaskName());
weblogicServer.setFork(true); weblogicServer.setFork(true);
weblogicServer.setDir(weblogicSystemHome); weblogicServer.setDir(weblogicSystemHome);
@@ -275,7 +275,7 @@ public class WLRun extends Task {
propertiesFile = new File(weblogicSystemHome, weblogicPropertiesFile); propertiesFile = new File(weblogicSystemHome, weblogicPropertiesFile);
if (!propertiesFile.exists()) { if (!propertiesFile.exists()) {
// OK, properties file may be absolute // OK, properties file may be absolute
propertiesFile = project.resolveFile(weblogicPropertiesFile);
propertiesFile = getProject().resolveFile(weblogicPropertiesFile);
if (!propertiesFile.exists()) { if (!propertiesFile.exists()) {
throw new BuildException("Properties file " + weblogicPropertiesFile + throw new BuildException("Properties file " + weblogicPropertiesFile +
" not found in weblogic home " + weblogicSystemHome + " not found in weblogic home " + weblogicSystemHome +
@@ -283,7 +283,7 @@ public class WLRun extends Task {
} }
} }


Java weblogicServer = (Java) project.createTask("java");
Java weblogicServer = (Java) getProject().createTask("java");
weblogicServer.setTaskName(getTaskName()); weblogicServer.setTaskName(getTaskName());
weblogicServer.setFork(true); weblogicServer.setFork(true);
weblogicServer.setClassname(weblogicMainClass); weblogicServer.setClassname(weblogicMainClass);


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLStop.java View File

@@ -117,7 +117,7 @@ public class WLStop extends Task {
throw new BuildException("The url of the weblogic server must be provided."); throw new BuildException("The url of the weblogic server must be provided.");
} }


Java weblogicAdmin = (Java) project.createTask("java");
Java weblogicAdmin = (Java) getProject().createTask("java");
weblogicAdmin.setFork(true); weblogicAdmin.setFork(true);
weblogicAdmin.setClassname("weblogic.Admin"); weblogicAdmin.setClassname("weblogic.Admin");
String args; String args;
@@ -152,7 +152,7 @@ public class WLStop extends Task {
*/ */
public Path createClasspath() { public Path createClasspath() {
if (classpath == null) { if (classpath == null) {
classpath = new Path(project);
classpath = new Path(getProject());
} }
return classpath.createPath(); return classpath.createPath();
} }


+ 1
- 7
src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java View File

@@ -131,10 +131,6 @@ public class Translate extends MatchingTask {
* Holds key value pairs loaded from resource bundle file * Holds key value pairs loaded from resource bundle file
*/ */
private Hashtable resourceMap = new Hashtable(); private Hashtable resourceMap = new Hashtable();
/**
* Generated locale based on user attributes
*/
private Locale locale;
/** /**
* Used to resolve file names. * Used to resolve file names.
*/ */
@@ -286,8 +282,6 @@ public class Translate extends MatchingTask {
bundleCountry = Locale.getDefault().getCountry(); bundleCountry = Locale.getDefault().getCountry();
} }


locale = new Locale(bundleLanguage, bundleCountry);

if (bundleVariant == null) { if (bundleVariant == null) {
Locale l = new Locale(bundleLanguage, bundleCountry); Locale l = new Locale(bundleLanguage, bundleCountry);
bundleVariant = l.getVariant(); bundleVariant = l.getVariant();
@@ -488,7 +482,7 @@ public class Translate extends MatchingTask {
private void translate() throws BuildException { private void translate() throws BuildException {
for (int i = 0; i < filesets.size(); i++) { for (int i = 0; i < filesets.size(); i++) {
FileSet fs = (FileSet) filesets.elementAt(i); FileSet fs = (FileSet) filesets.elementAt(i);
DirectoryScanner ds = fs.getDirectoryScanner(project);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
String[] srcFiles = ds.getIncludedFiles(); String[] srcFiles = ds.getIncludedFiles();
for (int j = 0; j < srcFiles.length; j++) { for (int j = 0; j < srcFiles.length; j++) {
try { try {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJImport.java View File

@@ -194,7 +194,7 @@ public class VAJImport extends VAJTask {
* Workspace. * Workspace.
*/ */
protected void importFileset(FileSet fileset) { protected void importFileset(FileSet fileset) {
DirectoryScanner ds = fileset.getDirectoryScanner(this.project);
DirectoryScanner ds = fileset.getDirectoryScanner(this.getProject());
if (ds.getIncludedFiles().length == 0) { if (ds.getIncludedFiles().length == 0) {
return; return;
} }


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java View File

@@ -237,12 +237,12 @@ public class JJTree extends Task {
targetName.substring(0, targetName.indexOf(".jjt")) + ".jj"); targetName.substring(0, targetName.indexOf(".jjt")) + ".jj");
if (javaFile.exists() if (javaFile.exists()
&& target.lastModified() < javaFile.lastModified()) { && target.lastModified() < javaFile.lastModified()) {
project.log("Target is already built - skipping (" + target + ")");
getProject().log("Target is already built - skipping (" + target + ")");
return; return;
} }
cmdl.createArgument().setValue(target.getAbsolutePath()); cmdl.createArgument().setValue(target.getAbsolutePath());


final Path classpath = cmdl.createClasspath(project);
final Path classpath = cmdl.createClasspath(getProject());
final File javaccJar = JavaCC.getArchiveFile(javaccHome); final File javaccJar = JavaCC.getArchiveFile(javaccHome);
classpath.createPathElement().setPath(javaccJar.getAbsolutePath()); classpath.createPathElement().setPath(javaccJar.getAbsolutePath());
classpath.addJavaRuntime(); classpath.addJavaRuntime();


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java View File

@@ -309,7 +309,7 @@ public class JavaCC extends Task {
} }
cmdl.createArgument().setValue(target.getAbsolutePath()); cmdl.createArgument().setValue(target.getAbsolutePath());


final Path classpath = cmdl.createClasspath(project);
final Path classpath = cmdl.createClasspath(getProject());
final File javaccJar = JavaCC.getArchiveFile(javaccHome); final File javaccJar = JavaCC.getArchiveFile(javaccHome);
classpath.createPathElement().setPath(javaccJar.getAbsolutePath()); classpath.createPathElement().setPath(javaccJar.getAbsolutePath());
classpath.addJavaRuntime(); classpath.addJavaRuntime();


+ 3
- 4
src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java View File

@@ -170,7 +170,7 @@ public class JDependTask extends Task {
*/ */
public Path createSourcespath() { public Path createSourcespath() {
if (_sourcesPath == null) { if (_sourcesPath == null) {
_sourcesPath = new Path(project);
_sourcesPath = new Path(getProject());
} }
return _sourcesPath.createPath(); return _sourcesPath.createPath();
} }
@@ -214,7 +214,7 @@ public class JDependTask extends Task {
*/ */
public Path createClasspath() { public Path createClasspath() {
if (_compileClasspath == null) { if (_compileClasspath == null) {
_compileClasspath = new Path(project);
_compileClasspath = new Path(getProject());
} }
return _compileClasspath.createPath(); return _compileClasspath.createPath();
} }
@@ -284,7 +284,6 @@ public class JDependTask extends Task {


// execute the test and get the return code // execute the test and get the return code
int exitValue = JDependTask.ERRORS; int exitValue = JDependTask.ERRORS;
boolean wasKilled = false;
if (!getFork()) { if (!getFork()) {
exitValue = executeInVM(commandline); exitValue = executeInVM(commandline);
} else { } else {
@@ -417,7 +416,7 @@ public class JDependTask extends Task {
execute.setCommandline(commandline.getCommandline()); execute.setCommandline(commandline.getCommandline());
if (getDir() != null) { if (getDir() != null) {
execute.setWorkingDirectory(getDir()); execute.setWorkingDirectory(getDir());
execute.setAntRun(project);
execute.setAntRun(getProject());
} }


if (getOutputFile() != null) { if (getOutputFile() != null) {


+ 4
- 12
src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java View File

@@ -133,13 +133,6 @@ public class JspC extends MatchingTask {
*/ */
protected boolean failOnError = true; protected boolean failOnError = true;


/**
* -uribase &lt;dir&gt; The uri directory compilations should be relative to
* (Default is "/")
*/

private File uribase;

/** /**
* -uriroot &lt;dir&gt; The root directory that uri files should be resolved * -uriroot &lt;dir&gt; The root directory that uri files should be resolved
* against, * against,
@@ -258,7 +251,7 @@ public class JspC extends MatchingTask {
* @param uribase The new Uribase value * @param uribase The new Uribase value
*/ */
public void setUribase(File uribase) { public void setUribase(File uribase) {
this.uribase = uribase;
log( "Uribase is currently an unused parameter", Project.MSG_WARN);
} }


public File getUribase() { public File getUribase() {
@@ -297,7 +290,7 @@ public class JspC extends MatchingTask {
*/ */
public Path createClasspath() { public Path createClasspath() {
if (classpath == null) { if (classpath == null) {
classpath = new Path(project);
classpath = new Path(getProject());
} }
return classpath.createPath(); return classpath.createPath();
} }
@@ -336,7 +329,7 @@ public class JspC extends MatchingTask {
*/ */
public Path createCompilerclasspath() { public Path createCompilerclasspath() {
if (compilerClasspath == null) { if (compilerClasspath == null) {
compilerClasspath = new Path(project);
compilerClasspath = new Path(getProject());
} }
return compilerClasspath.createPath(); return compilerClasspath.createPath();
} }
@@ -445,7 +438,7 @@ public class JspC extends MatchingTask {
resetFileLists(); resetFileLists();
int filecount = 0; int filecount = 0;
for (int i = 0; i < list.length; i++) { for (int i = 0; i < list.length; i++) {
File srcDir = (File) project.resolveFile(list[i]);
File srcDir = (File) getProject().resolveFile(list[i]);
if (!srcDir.exists()) { if (!srcDir.exists()) {
throw new BuildException("srcdir \"" + srcDir.getPath() + throw new BuildException("srcdir \"" + srcDir.getPath() +
"\" does not exist!", location); "\" does not exist!", location);
@@ -599,7 +592,6 @@ public class JspC extends MatchingTask {
} }
String javaFileName = mangler.mapJspToJavaName(srcFile); String javaFileName = mangler.mapJspToJavaName(srcFile);
// String srcFileDir=srcFile.getParent(); // String srcFileDir=srcFile.getParent();
String packageNameIn = srcFile.getAbsolutePath();
return new File(dest, javaFileName); return new File(dest, javaFileName);
} }




+ 5
- 8
src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java View File

@@ -143,16 +143,14 @@ public class WLJspc extends MatchingTask {
} }
String systemClassPath = System.getProperty("java.class.path");
pathToPackage
pathToPackage
= this.destinationPackage.replace('.', File.separatorChar); = this.destinationPackage.replace('.', File.separatorChar);
// get all the files in the sourceDirectory // get all the files in the sourceDirectory
DirectoryScanner ds = super.getDirectoryScanner(sourceDirectory); DirectoryScanner ds = super.getDirectoryScanner(sourceDirectory);


//use the systemclasspath as well, to include the ant jar //use the systemclasspath as well, to include the ant jar
if (compileClasspath == null) { if (compileClasspath == null) {
compileClasspath = new Path(project);
compileClasspath = new Path(getProject());
} }
compileClasspath.append(Path.systemClasspath); compileClasspath.append(Path.systemClasspath);
@@ -162,7 +160,7 @@ public class WLJspc extends MatchingTask {
// Therefore, takes loads of time // Therefore, takes loads of time
// Can pass directories at a time (*.jsp) but easily runs out of memory on hefty dirs // Can pass directories at a time (*.jsp) but easily runs out of memory on hefty dirs
// (even on a Sun) // (even on a Sun)
Java helperTask = (Java) project.createTask("java");
Java helperTask = (Java) getProject().createTask("java");
helperTask.setFork(true); helperTask.setFork(true);
helperTask.setClassname("weblogic.jspc"); helperTask.setClassname("weblogic.jspc");
helperTask.setTaskName(getTaskName()); helperTask.setTaskName(getTaskName());
@@ -245,7 +243,7 @@ public class WLJspc extends MatchingTask {
*/ */
public Path createClasspath() { public Path createClasspath() {
if (compileClasspath == null) { if (compileClasspath == null) {
compileClasspath = new Path(project);
compileClasspath = new Path(getProject());
} }
return compileClasspath; return compileClasspath;
} }
@@ -297,8 +295,7 @@ public class WLJspc extends MatchingTask {
// Can be written better... this is too hacky! // Can be written better... this is too hacky!
jspFile = new File(files[i]); jspFile = new File(files[i]);
parents = jspFile.getParent(); parents = jspFile.getParent();
int loc = 0;

if ((parents != null) && (!("").equals(parents))) { if ((parents != null) && (!("").equals(parents))) {
parents = this.replaceString(parents, File.separator, "_/"); parents = this.replaceString(parents, File.separator, "_/");
pack = pathToPackage + File.separator + "_" + parents; pack = pathToPackage + File.separator + "_" + parents;


+ 12
- 12
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -406,7 +406,7 @@ public class JUnitTask extends Task {
* @since Ant 1.2 * @since Ant 1.2
*/ */
public Path createClasspath() { public Path createClasspath() {
return commandline.createClasspath(project).createPath();
return commandline.createClasspath(getProject()).createPath();
} }


/** /**
@@ -451,7 +451,7 @@ public class JUnitTask extends Task {
* @since Ant 1.2 * @since Ant 1.2
*/ */
public BatchTest createBatchTest() { public BatchTest createBatchTest() {
BatchTest test = new BatchTest(project);
BatchTest test = new BatchTest(getProject());
batchTests.addElement(test); batchTests.addElement(test);
return test; return test;
} }
@@ -523,7 +523,7 @@ public class JUnitTask extends Task {
Enumeration list = getIndividualTests(); Enumeration list = getIndividualTests();
while (list.hasMoreElements()) { while (list.hasMoreElements()) {
JUnitTest test = (JUnitTest) list.nextElement(); JUnitTest test = (JUnitTest) list.nextElement();
if (test.shouldRun(project)) {
if (test.shouldRun(getProject())) {
execute(test); execute(test);
} }
} }
@@ -537,7 +537,7 @@ public class JUnitTask extends Task {
// set the default values if not specified // set the default values if not specified
//@todo should be moved to the test class instead. //@todo should be moved to the test class instead.
if (test.getTodir() == null) { if (test.getTodir() == null) {
test.setTodir(project.resolveFile("."));
test.setTodir(getProject().resolveFile("."));
} }


if (test.getOutfile() == null) { if (test.getOutfile() == null) {
@@ -571,10 +571,10 @@ public class JUnitTask extends Task {
log("TEST " + test.getName() + " FAILED" log("TEST " + test.getName() + " FAILED"
+ (wasKilled ? " (timeout)" : ""), Project.MSG_ERR); + (wasKilled ? " (timeout)" : ""), Project.MSG_ERR);
if (errorOccurredHere && test.getErrorProperty() != null) { if (errorOccurredHere && test.getErrorProperty() != null) {
project.setNewProperty(test.getErrorProperty(), "true");
getProject().setNewProperty(test.getErrorProperty(), "true");
} }
if (failureOccurredHere && test.getFailureProperty() != null) { if (failureOccurredHere && test.getFailureProperty() != null) {
project.setNewProperty(test.getFailureProperty(), "true");
getProject().setNewProperty(test.getFailureProperty(), "true");
} }
} }
} }
@@ -635,10 +635,10 @@ public class JUnitTask extends Task {
// forked test // forked test
File propsFile = File propsFile =
FileUtils.newFileUtils().createTempFile("junit", ".properties", FileUtils.newFileUtils().createTempFile("junit", ".properties",
project.getBaseDir());
getProject().getBaseDir());
cmd.createArgument().setValue("propsfile=" cmd.createArgument().setValue("propsfile="
+ propsFile.getAbsolutePath()); + propsFile.getAbsolutePath());
Hashtable p = project.getProperties();
Hashtable p = getProject().getProperties();
Properties props = new Properties(); Properties props = new Properties();
for (Enumeration enum = p.keys(); enum.hasMoreElements();) { for (Enumeration enum = p.keys(); enum.hasMoreElements();) {
Object key = enum.nextElement(); Object key = enum.nextElement();
@@ -659,7 +659,7 @@ public class JUnitTask extends Task {
Project.MSG_WARN), Project.MSG_WARN),
watchdog); watchdog);
execute.setCommandline(cmd.getCommandline()); execute.setCommandline(cmd.getCommandline());
execute.setAntRun(project);
execute.setAntRun(getProject());
if (dir != null) { if (dir != null) {
execute.setWorkingDirectory(dir); execute.setWorkingDirectory(dir);
} }
@@ -734,7 +734,7 @@ public class JUnitTask extends Task {
*/ */
private int executeInVM(JUnitTest arg) throws BuildException { private int executeInVM(JUnitTest arg) throws BuildException {
JUnitTest test = (JUnitTest) arg.clone(); JUnitTest test = (JUnitTest) arg.clone();
test.setProperties(project.getProperties());
test.setProperties(getProject().getProperties());
if (dir != null) { if (dir != null) {
log("dir attribute ignored if running in the same VM", log("dir attribute ignored if running in the same VM",
Project.MSG_WARN); Project.MSG_WARN);
@@ -765,7 +765,7 @@ public class JUnitTask extends Task {
classpath.append(antRuntimeClasses); classpath.append(antRuntimeClasses);
} }


cl = new AntClassLoader(null, project, classpath, false);
cl = new AntClassLoader(null, getProject(), classpath, false);
log("Using CLASSPATH " + cl.getClasspath(), log("Using CLASSPATH " + cl.getClasspath(),
Project.MSG_VERBOSE); Project.MSG_VERBOSE);


@@ -882,7 +882,7 @@ public class JUnitTask extends Task {
String filename = test.getOutfile() + fe.getExtension(); String filename = test.getOutfile() + fe.getExtension();
File destFile = new File(test.getTodir(), filename); File destFile = new File(test.getTodir(), filename);
String absFilename = destFile.getAbsolutePath(); String absFilename = destFile.getAbsolutePath();
return project.resolveFile(absFilename);
return getProject().resolveFile(absFilename);
} }
return null; return null;
} }


+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java View File

@@ -187,7 +187,7 @@ public class XMLResultAggregator extends Task implements XMLConstants {
toFile = DEFAULT_FILENAME; toFile = DEFAULT_FILENAME;
} }
if (toDir == null){ if (toDir == null){
toDir = project.resolveFile(DEFAULT_DIR);
toDir = getProject().resolveFile(DEFAULT_DIR);
} }
return new File(toDir, toFile); return new File(toDir, toFile);
} }
@@ -202,14 +202,14 @@ public class XMLResultAggregator extends Task implements XMLConstants {
final int size = filesets.size(); final int size = filesets.size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
FileSet fs = (FileSet) filesets.elementAt(i); FileSet fs = (FileSet) filesets.elementAt(i);
DirectoryScanner ds = fs.getDirectoryScanner(project);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
ds.scan(); ds.scan();
String[] f = ds.getIncludedFiles(); String[] f = ds.getIncludedFiles();
for (int j = 0; j < f.length; j++) { for (int j = 0; j < f.length; j++) {
String pathname = f[j]; String pathname = f[j];
if (pathname.endsWith(".xml")) { if (pathname.endsWith(".xml")) {
File file = new File(ds.getBasedir(), pathname); File file = new File(ds.getBasedir(), pathname);
file = project.resolveFile(file.getPath());
file = getProject().resolveFile(file.getPath());
v.addElement(file); v.addElement(file);
} }
} }


+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java View File

@@ -144,7 +144,7 @@ public abstract class AbstractMetamataTask extends Task {
*/ */
public Path createClasspath() { public Path createClasspath() {
if (classPath == null) { if (classPath == null) {
classPath = new Path(project);
classPath = new Path(getProject());
} }
return classPath; return classPath;
} }
@@ -155,7 +155,7 @@ public abstract class AbstractMetamataTask extends Task {
*/ */
public Path createSourcepath() { public Path createSourcepath() {
if (sourcePath == null) { if (sourcePath == null) {
sourcePath = new Path(project);
sourcePath = new Path(getProject());
} }
return sourcePath; return sourcePath;
} }
@@ -212,7 +212,7 @@ public abstract class AbstractMetamataTask extends Task {


// set the classpath as the jar file // set the classpath as the jar file
File jar = getMetamataJar(metamataHome); File jar = getMetamataJar(metamataHome);
final Path classPath = cmdl.createClasspath(project);
final Path classPath = cmdl.createClasspath(getProject());
classPath.createPathElement().setLocation(jar); classPath.createPathElement().setLocation(jar);


// set the metamata.home property // set the metamata.home property
@@ -332,7 +332,7 @@ public abstract class AbstractMetamataTask extends Task {
Hashtable files = new Hashtable(); Hashtable files = new Hashtable();
for (int i = 0; i < fileSets.size(); i++) { for (int i = 0; i < fileSets.size(); i++) {
FileSet fs = (FileSet) fileSets.elementAt(i); FileSet fs = (FileSet) fileSets.elementAt(i);
DirectoryScanner ds = fs.getDirectoryScanner(project);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
ds.scan(); ds.scan();
String[] f = ds.getIncludedFiles(); String[] f = ds.getIncludedFiles();
log(i + ") Adding " + f.length + " files from directory " + ds.getBasedir(), Project.MSG_VERBOSE); log(i + ") Adding " + f.length + " files from directory " + ds.getBasedir(), Project.MSG_VERBOSE);


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java View File

@@ -161,7 +161,7 @@ Format Options
*/ */
public Path createPath() { public Path createPath() {
if (path == null) { if (path == null) {
path = new Path(project);
path = new Path(getProject());
} }
return path; return path;




+ 5
- 5
src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java View File

@@ -144,7 +144,7 @@ public class MParse extends AbstractMetamataTask {


// set the classpath as the jar files // set the classpath as the jar files
File[] jars = getMetamataLibs(); File[] jars = getMetamataLibs();
final Path classPath = cmdl.createClasspath(project);
final Path classPath = cmdl.createClasspath(getProject());
for (int i = 0; i < jars.length; i++){ for (int i = 0; i < jars.length; i++){
classPath.createPathElement().setLocation(jars[i]); classPath.createPathElement().setLocation(jars[i]);
} }
@@ -175,7 +175,7 @@ public class MParse extends AbstractMetamataTask {
pathname = pathname.substring(0, pos) + ".java"; pathname = pathname.substring(0, pos) + ".java";
File javaFile = new File(pathname); File javaFile = new File(pathname);
if (javaFile.exists() && target.lastModified() < javaFile.lastModified()) { if (javaFile.exists() && target.lastModified() < javaFile.lastModified()) {
project.log("Target is already build - skipping (" + target + ")");
getProject().log("Target is already build - skipping (" + target + ")");
return; return;
} }


@@ -203,7 +203,7 @@ public class MParse extends AbstractMetamataTask {
name = "__jj" + name.substring(0, pos) + ".sunjj"; name = "__jj" + name.substring(0, pos) + ".sunjj";
final File sunjj = new File(target.getParent(), name); final File sunjj = new File(target.getParent(), name);
if (sunjj.exists()) { if (sunjj.exists()) {
project.log("Removing stale file: " + sunjj.getName());
getProject().log("Removing stale file: " + sunjj.getName());
sunjj.delete(); sunjj.delete();
} }
} }
@@ -236,7 +236,7 @@ public class MParse extends AbstractMetamataTask {
if (metamataHome == null || !metamataHome.exists()){ if (metamataHome == null || !metamataHome.exists()){
throw new BuildException("'metamatahome' must point to Metamata home directory."); throw new BuildException("'metamatahome' must point to Metamata home directory.");
} }
metamataHome = project.resolveFile(metamataHome.getPath());
metamataHome = getProject().resolveFile(metamataHome.getPath());


// check that the needed jar exists. // check that the needed jar exists.
File[] jars = getMetamataLibs(); File[] jars = getMetamataLibs();
@@ -252,7 +252,7 @@ public class MParse extends AbstractMetamataTask {
|| !target.getName().endsWith(".jj")) { || !target.getName().endsWith(".jj")) {
throw new BuildException("Invalid target: " + target); throw new BuildException("Invalid target: " + target);
} }
target = project.resolveFile(target.getPath());
target = getProject().resolveFile(target.getPath());
} }


/** /**


+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java View File

@@ -471,10 +471,10 @@ public class FTP
FileScanner ds; FileScanner ds;


if (action == SEND_FILES) { if (action == SEND_FILES) {
ds = fs.getDirectoryScanner(project);
ds = fs.getDirectoryScanner(getProject());
} else { } else {
ds = new FTPDirectoryScanner(ftp); ds = new FTPDirectoryScanner(ftp);
fs.setupDirectoryScanner(ds, project);
fs.setupDirectoryScanner(ds, getProject());
ds.scan(); ds.scan();
} }


@@ -704,7 +704,7 @@ public class FTP


try { try {
// XXX - why not simply new File(dir, filename)? // XXX - why not simply new File(dir, filename)?
File file = project.resolveFile(new File(dir, filename).getPath());
File file = getProject().resolveFile(new File(dir, filename).getPath());


if (newerOnly && isUpToDate(ftp, file, resolveFile(filename))) { if (newerOnly && isUpToDate(ftp, file, resolveFile(filename))) {
return; return;
@@ -790,7 +790,7 @@ public class FTP
OutputStream outstream = null; OutputStream outstream = null;


try { try {
File file = project.resolveFile(new File(dir, filename).getPath());
File file = getProject().resolveFile(new File(dir, filename).getPath());


if (newerOnly && isUpToDate(ftp, file, resolveFile(filename))) { if (newerOnly && isUpToDate(ftp, file, resolveFile(filename))) {
return; return;


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java View File

@@ -134,7 +134,7 @@ public class P4Add extends P4Base {


for (int i = 0; i < filesets.size(); i++) { for (int i = 0; i < filesets.size(); i++) {
FileSet fs = (FileSet) filesets.elementAt(i); FileSet fs = (FileSet) filesets.elementAt(i);
DirectoryScanner ds = fs.getDirectoryScanner(project);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
//File fromDir = fs.getDir(project); //File fromDir = fs.getDir(project);


String[] srcFiles = ds.getIncludedFiles(); String[] srcFiles = ds.getIncludedFiles();


+ 4
- 12
src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java View File

@@ -165,13 +165,13 @@ public abstract class P4Base extends org.apache.tools.ant.Task {
//Get default P4 settings from environment - Mark would have done something cool with //Get default P4 settings from environment - Mark would have done something cool with
//introspection here.....:-) //introspection here.....:-)
String tmpprop; String tmpprop;
if ((tmpprop = project.getProperty("p4.port")) != null) {
if ((tmpprop = getProject().getProperty("p4.port")) != null) {
setPort(tmpprop); setPort(tmpprop);
} }
if ((tmpprop = project.getProperty("p4.client")) != null) {
if ((tmpprop = getProject().getProperty("p4.client")) != null) {
setClient(tmpprop); setClient(tmpprop);
} }
if ((tmpprop = project.getProperty("p4.user")) != null) {
if ((tmpprop = getProject().getProperty("p4.user")) != null) {
setUser(tmpprop); setUser(tmpprop);
} }
} }
@@ -182,7 +182,6 @@ public abstract class P4Base extends org.apache.tools.ant.Task {


/** Execute P4 command assembled by subclasses. /** Execute P4 command assembled by subclasses.
@param command The command to run @param command The command to run
@param p4input Input to be fed to command on stdin
@param handler A P4Handler to process any input and output @param handler A P4Handler to process any input and output
*/ */
protected void execP4Command(String command, P4Handler handler) throws BuildException { protected void execP4Command(String command, P4Handler handler) throws BuildException {
@@ -203,13 +202,6 @@ public abstract class P4Base extends org.apache.tools.ant.Task {
} }
commandline.createArgument().setLine(command); commandline.createArgument().setLine(command);



String[] cmdline = commandline.getCommandline();
String cmdl = "";
for (int i = 0; i < cmdline.length; i++) {
cmdl += cmdline[i] + " ";
}

log(commandline.describeCommand(), Project.MSG_VERBOSE); log(commandline.describeCommand(), Project.MSG_VERBOSE);


if (handler == null) { if (handler == null) {
@@ -218,7 +210,7 @@ public abstract class P4Base extends org.apache.tools.ant.Task {


Execute exe = new Execute(handler, null); Execute exe = new Execute(handler, null);


exe.setAntRun(project);
exe.setAntRun(getProject());


exe.setCommandline(commandline.getCommandline()); exe.setCommandline(commandline.getCommandline());




+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java View File

@@ -87,7 +87,7 @@ public class P4Change extends P4Base {
if (emptyChangeList == null) { if (emptyChangeList == null) {
emptyChangeList = getEmptyChangeList(); emptyChangeList = getEmptyChangeList();
} }
final Project myProj = project;
final Project myProj = getProject();


P4Handler handler = new P4HandlerAdapter() { P4Handler handler = new P4HandlerAdapter() {
public void process(String line) { public void process(String line) {


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java View File

@@ -139,7 +139,7 @@ public class P4Counter extends P4Base {
} }


if (shouldSetProperty) { if (shouldSetProperty) {
final Project myProj = project;
final Project myProj = getProject();


P4Handler handler = new P4HandlerAdapter() { P4Handler handler = new P4HandlerAdapter() {
public void process(String line) { public void process(String line) {


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java View File

@@ -184,7 +184,7 @@ public class CovMerge extends Task {
for (int j = 0; j < f.length; j++) { for (int j = 0; j < f.length; j++) {
String pathname = f[j]; String pathname = f[j];
File file = new File(ds.getBasedir(), pathname); File file = new File(ds.getBasedir(), pathname);
file = project.resolveFile(file.getPath());
file = getProject().resolveFile(file.getPath());
v.addElement(file); v.addElement(file);
} }
} }
@@ -210,7 +210,7 @@ public class CovMerge extends Task {
pw.println(snapshots[i].getAbsolutePath()); pw.println(snapshots[i].getAbsolutePath());
} }
// last file is the output snapshot // last file is the output snapshot
pw.println(project.resolveFile(tofile.getPath()));
pw.println(getProject().resolveFile(tofile.getPath()));
pw.flush(); pw.flush();
} catch (IOException e) { } catch (IOException e) {
throw new BuildException("I/O error while writing to " + file, e); throw new BuildException("I/O error while writing to " + file, e);


+ 6
- 6
src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java View File

@@ -228,7 +228,7 @@ public class CovReport extends Task {
*/ */
public Path createSourcepath() { public Path createSourcepath() {
if (sourcePath == null) { if (sourcePath == null) {
sourcePath = new Path(project);
sourcePath = new Path(getProject());
} }
return sourcePath.createPath(); return sourcePath.createPath();
} }
@@ -253,7 +253,7 @@ public class CovReport extends Task {
*/ */
public Path createCoveragepath() { public Path createCoveragepath() {
if (coveragePath == null) { if (coveragePath == null) {
coveragePath = new Path(project);
coveragePath = new Path(getProject());
} }
return coveragePath.createPath(); return coveragePath.createPath();
} }
@@ -342,12 +342,12 @@ public class CovReport extends Task {
if (filters != null) { if (filters != null) {
v.addElement("-filters=" + filters); v.addElement("-filters=" + filters);
} }
v.addElement("-output=" + project.resolveFile(tofile.getPath()));
v.addElement("-snapshot=" + project.resolveFile(snapshot.getPath()));
v.addElement("-output=" + getProject().resolveFile(tofile.getPath()));
v.addElement("-snapshot=" + getProject().resolveFile(snapshot.getPath()));
// as a default -sourcepath use . in JProbe, so use project . // as a default -sourcepath use . in JProbe, so use project .
if (sourcePath == null) { if (sourcePath == null) {
sourcePath = new Path(project);
sourcePath.createPath().setLocation(project.resolveFile("."));
sourcePath = new Path(getProject());
sourcePath.createPath().setLocation(getProject().resolveFile("."));
} }
v.addElement("-sourcepath=" + sourcePath); v.addElement("-sourcepath=" + sourcePath);




+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java View File

@@ -297,7 +297,7 @@ public class Coverage extends Task {
* classpath to run the files. * classpath to run the files.
*/ */
public Path createClasspath() { public Path createClasspath() {
return cmdlJava.createClasspath(project).createPath();
return cmdlJava.createClasspath(getProject()).createPath();
} }


/** /**
@@ -370,14 +370,14 @@ public class Coverage extends Task {
if (snapshotDir == null) { if (snapshotDir == null) {
snapshotDir = new File("."); snapshotDir = new File(".");
} }
snapshotDir = project.resolveFile(snapshotDir.getPath());
snapshotDir = getProject().resolveFile(snapshotDir.getPath());
if (!snapshotDir.isDirectory() || !snapshotDir.exists()) { if (!snapshotDir.isDirectory() || !snapshotDir.exists()) {
throw new BuildException("Snapshot directory does not exists :" + snapshotDir); throw new BuildException("Snapshot directory does not exists :" + snapshotDir);
} }
if (workingDir == null) { if (workingDir == null) {
workingDir = new File("."); workingDir = new File(".");
} }
workingDir = project.resolveFile(workingDir.getPath());
workingDir = getProject().resolveFile(workingDir.getPath());


// check for info, do your best to select the java executable. // check for info, do your best to select the java executable.
// JProbe 3.0 fails if there is no javaexe option. So // JProbe 3.0 fails if there is no javaexe option. So
@@ -409,7 +409,7 @@ public class Coverage extends Task {
params.addElement("-jp_vm=" + vm); params.addElement("-jp_vm=" + vm);
} }
if (javaExe != null) { if (javaExe != null) {
params.addElement("-jp_java_exe=" + project.resolveFile(javaExe.getPath()));
params.addElement("-jp_java_exe=" + getProject().resolveFile(javaExe.getPath()));
} }
params.addElement("-jp_working_dir=" + workingDir.getPath()); params.addElement("-jp_working_dir=" + workingDir.getPath());
params.addElement("-jp_snapshot_dir=" + snapshotDir.getPath()); params.addElement("-jp_snapshot_dir=" + snapshotDir.getPath());


+ 5
- 5
src/main/org/apache/tools/ant/taskdefs/optional/sos/SOS.java View File

@@ -455,10 +455,10 @@ public abstract class SOS extends Task {
*/ */
public String getLocalPath() { public String getLocalPath() {
if (localPath == null) { if (localPath == null) {
return project.getBaseDir().getAbsolutePath();
return getProject().getBaseDir().getAbsolutePath();
} else { } else {
// make sure localDir exists, create it if it doesn't // make sure localDir exists, create it if it doesn't
File dir = project.resolveFile(localPath);
File dir = getProject().resolveFile(localPath);
if (!dir.exists()) { if (!dir.exists()) {
boolean done = dir.mkdirs(); boolean done = dir.mkdirs();
if (!done) { if (!done) {
@@ -466,7 +466,7 @@ public abstract class SOS extends Task {
"successful for an unknown reason"; "successful for an unknown reason";
throw new BuildException(msg, location); throw new BuildException(msg, location);
} }
project.log("Created dir: " + dir.getAbsolutePath());
getProject().log("Created dir: " + dir.getAbsolutePath());
} }
return dir.getAbsolutePath(); return dir.getAbsolutePath();
} }
@@ -486,8 +486,8 @@ public abstract class SOS extends Task {
Project.MSG_INFO, Project.MSG_INFO,
Project.MSG_WARN)); Project.MSG_WARN));


exe.setAntRun(project);
exe.setWorkingDirectory(project.getBaseDir());
exe.setAntRun(getProject());
exe.setWorkingDirectory(getProject().getBaseDir());
exe.setCommandline(cmd.getCommandline()); exe.setCommandline(cmd.getCommandline());
return exe.execute(); return exe.execute();
} catch (java.io.IOException e) { } catch (java.io.IOException e) {


+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java View File

@@ -122,7 +122,7 @@ public abstract class MSVSS extends Task {
} }


/** /**
* @return the appropriate login command if the 'login' attribute was specified, otherwise an empty string
* the appropriate login command if the 'login' attribute was specified, otherwise an empty string
*/ */
public void getLoginCommand(Commandline cmd) { public void getLoginCommand(Commandline cmd) {
if (m_vssLogin == null) { if (m_vssLogin == null) {
@@ -187,8 +187,8 @@ public abstract class MSVSS extends Task {
exe.setEnvironment(newEnv); exe.setEnvironment(newEnv);
} }
exe.setAntRun(project);
exe.setWorkingDirectory(project.getBaseDir());
exe.setAntRun(getProject());
exe.setWorkingDirectory(getProject().getBaseDir());
exe.setCommandline(cmd.getCommandline()); exe.setCommandline(cmd.getCommandline());
return exe.execute(); return exe.execute();
} catch (java.io.IOException e) { } catch (java.io.IOException e) {


+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java View File

@@ -138,7 +138,7 @@ public class MSVSSCHECKIN extends MSVSS {
return; return;
} else { } else {
// make sure m_LocalDir exists, create it if it doesn't // make sure m_LocalDir exists, create it if it doesn't
File dir = project.resolveFile(m_LocalPath);
File dir = getProject().resolveFile(m_LocalPath);
if (!dir.exists()) { if (!dir.exists()) {
boolean done = dir.mkdirs(); boolean done = dir.mkdirs();
if (!done) { if (!done) {
@@ -147,7 +147,7 @@ public class MSVSSCHECKIN extends MSVSS {
+ "succesful for an unknown reason"; + "succesful for an unknown reason";
throw new BuildException(msg, location); throw new BuildException(msg, location);
} }
project.log("Created dir: " + dir.getAbsolutePath());
getProject().log("Created dir: " + dir.getAbsolutePath());
} }


cmd.createArgument().setValue(FLAG_OVERRIDE_WORKING_DIR cmd.createArgument().setValue(FLAG_OVERRIDE_WORKING_DIR
@@ -164,7 +164,7 @@ public class MSVSSCHECKIN extends MSVSS {
} }


/** /**
* @return the 'recursive' command if the attribute was 'true', otherwise an empty string
* the 'recursive' command if the attribute was 'true', otherwise an empty string
*/ */
public void getRecursiveCommand(Commandline cmd) { public void getRecursiveCommand(Commandline cmd) {
if (!m_Recursive) { if (!m_Recursive) {
@@ -182,7 +182,7 @@ public class MSVSSCHECKIN extends MSVSS {
} }


/** /**
* @return the 'make writable' command if the attribute was 'true', otherwise an empty string
* the 'make writable' command if the attribute was 'true', otherwise an empty string
*/ */
public void getWritableCommand(Commandline cmd) { public void getWritableCommand(Commandline cmd) {
if (!m_Writable) { if (!m_Writable) {


+ 3
- 3
src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java View File

@@ -138,7 +138,7 @@ public class MSVSSCHECKOUT extends MSVSS {
return; return;
} else { } else {
// make sure m_LocalDir exists, create it if it doesn't // make sure m_LocalDir exists, create it if it doesn't
File dir = project.resolveFile(m_LocalPath);
File dir = getProject().resolveFile(m_LocalPath);
if (!dir.exists()) { if (!dir.exists()) {
boolean done = dir.mkdirs(); boolean done = dir.mkdirs();
if (!done) { if (!done) {
@@ -146,7 +146,7 @@ public class MSVSSCHECKOUT extends MSVSS {
"succesful for an unknown reason"; "succesful for an unknown reason";
throw new BuildException(msg, location); throw new BuildException(msg, location);
} }
project.log("Created dir: " + dir.getAbsolutePath());
getProject().log("Created dir: " + dir.getAbsolutePath());
} }


cmd.createArgument().setValue(FLAG_OVERRIDE_WORKING_DIR + m_LocalPath); cmd.createArgument().setValue(FLAG_OVERRIDE_WORKING_DIR + m_LocalPath);
@@ -162,7 +162,7 @@ public class MSVSSCHECKOUT extends MSVSS {
} }


/** /**
* @return the 'recursive' command if the attribute was 'true', otherwise an empty string
* the 'recursive' command if the attribute was 'true', otherwise an empty string
*/ */
public void getRecursiveCommand(Commandline cmd) { public void getRecursiveCommand(Commandline cmd) {
if (!m_Recursive) { if (!m_Recursive) {


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save