mbenson     2005/01/28 11:12:59

  Modified:    src/main/org/apache/tools/ant Tag: ANT_16_BRANCH
                        Project.java
  Log:
  Sync with HEAD
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.154.2.16 +207 -243  ant/src/main/org/apache/tools/ant/Project.java
  
  Index: Project.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/Project.java,v
  retrieving revision 1.154.2.15
  retrieving revision 1.154.2.16
  diff -u -r1.154.2.15 -r1.154.2.16
  --- Project.java      14 Jan 2005 10:12:31 -0000      1.154.2.15
  +++ Project.java      28 Jan 2005 19:12:59 -0000      1.154.2.16
  @@ -33,6 +33,7 @@
   import java.util.HashSet;
   import org.apache.tools.ant.input.DefaultInputHandler;
   import org.apache.tools.ant.input.InputHandler;
  +import org.apache.tools.ant.loader.AntClassLoader2;
   import org.apache.tools.ant.helper.DefaultExecutor;
   import org.apache.tools.ant.helper.KeepGoingExecutor;
   import org.apache.tools.ant.types.FilterSet;
  @@ -58,61 +59,54 @@
    */
   
   public class Project {
  -    /** Message priority of "error". */
  +    /** Message priority of "error". */
       public static final int MSG_ERR = 0;
  -    /** Message priority of "warning". */
  +    /** Message priority of "warning". */
       public static final int MSG_WARN = 1;
  -    /** Message priority of "information". */
  +    /** Message priority of "information". */
       public static final int MSG_INFO = 2;
  -    /** Message priority of "verbose". */
  +    /** Message priority of "verbose". */
       public static final int MSG_VERBOSE = 3;
  -    /** Message priority of "debug". */
  +    /** Message priority of "debug". */
       public static final int MSG_DEBUG = 4;
   
       /**
  -     * Constant for the "visiting" state, used when
  +     * Constant for the "visiting" state, used when
        * traversing a DFS of target dependencies.
        */
       private static final String VISITING = "VISITING";
       /**
  -     * Constant for the "visited" state, used when
  +     * Constant for the "visited" state, used when
        * traversing a DFS of target dependencies.
        */
       private static final String VISITED = "VISITED";
   
       /**
  -     * The class name of the Ant class loader to use for
  -     * JDK 1.2 and above
  -     */
  -    private static final String ANTCLASSLOADER_JDK12
  -        = "org.apache.tools.ant.loader.AntClassLoader2";
  -
  -    /**
  -     * Version constant for Java 1.0
  +     * Version constant for Java 1.0 .
        *
        * @deprecated Use [EMAIL PROTECTED] JavaEnvUtils#JAVA_1_0} instead.
        */
       public static final String JAVA_1_0 = JavaEnvUtils.JAVA_1_0;
       /**
  -     * Version constant for Java 1.1
  +     * Version constant for Java 1.1 .
        *
        * @deprecated Use [EMAIL PROTECTED] JavaEnvUtils#JAVA_1_1} instead.
        */
       public static final String JAVA_1_1 = JavaEnvUtils.JAVA_1_1;
       /**
  -     * Version constant for Java 1.2
  +     * Version constant for Java 1.2 .
        *
        * @deprecated Use [EMAIL PROTECTED] JavaEnvUtils#JAVA_1_2} instead.
        */
       public static final String JAVA_1_2 = JavaEnvUtils.JAVA_1_2;
       /**
  -     * Version constant for Java 1.3
  +     * Version constant for Java 1.3 .
        *
        * @deprecated Use [EMAIL PROTECTED] JavaEnvUtils#JAVA_1_3} instead.
        */
       public static final String JAVA_1_3 = JavaEnvUtils.JAVA_1_3;
       /**
  -     * Version constant for Java 1.4
  +     * Version constant for Java 1.4 .
        *
        * @deprecated Use [EMAIL PROTECTED] JavaEnvUtils#JAVA_1_4} instead.
        */
  @@ -123,6 +117,9 @@
       /** Default filter end token. */
       public static final String TOKEN_END = FilterSet.DEFAULT_TOKEN_END;
   
  +    /** Instance of a utility class to use for file operations. */
  +    private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
  +
       /** Name of this project. */
       private String name;
       /** Description for this project (if any). */
  @@ -159,7 +156,7 @@
       private Vector listeners = new Vector();
   
       /**
  -     * The Ant core classloader - may be <code>null</code> if using
  +     * The Ant core classloader--may be <code>null</code> if using
        * parent classloader.
        */
       private ClassLoader coreLoader = null;
  @@ -176,17 +173,22 @@
       private InputHandler inputHandler = null;
   
       /**
  -     * The default input stream used to read any input
  +     * The default input stream used to read any input.
        */
       private InputStream defaultInputStream = null;
   
       /**
  -     * Keep going flag
  +     * Keep going flag.
        */
       private boolean keepGoingMode = false;
   
       /**
  -     * Sets the input handler
  +     * Flag which catches Listeners which try to use System.out or 
System.err .
  +     */
  +    private boolean loggingMessage = false;
  +
  +    /**
  +     * Set the input handler.
        *
        * @param handler the InputHandler instance to use for gathering input.
        */
  @@ -208,17 +210,17 @@
       }
   
       /**
  -     * Get this project's input stream
  +     * Get this project's input stream.
        *
        * @return the InputStream instance in use by this Project instance to
  -     * read input
  +     * read input.
        */
       public InputStream getDefaultInputStream() {
           return defaultInputStream;
       }
   
       /**
  -     * Retrieves the current input handler.
  +     * Retrieve the current input handler.
        *
        * @return the InputHandler instance currently in place for the project
        *         instance.
  @@ -227,25 +229,16 @@
           return inputHandler;
       }
   
  -    /** Instance of a utility class to use for file operations. */
  -    private FileUtils fileUtils;
  -
       /**
  -     * Flag which catches Listeners which try to use System.out or System.err
  -     */
  -    private boolean loggingMessage = false;
  -
  -    /**
  -     * Creates a new Ant project.
  +     * Create a new Ant project.
        */
       public Project() {
  -        fileUtils = FileUtils.newFileUtils();
           inputHandler = new DefaultInputHandler();
       }
   
       /**
  -     * inits a sub project - used by taskdefs.Ant
  -     * @param subProject the subproject to initialize
  +     * Init a sub project--used by taskdefs.Ant .
  +     * @param subProject the subproject to initialize.
        */
       public void initSubProject(Project subProject) {
           ComponentHelper.getComponentHelper(subProject)
  @@ -254,12 +247,12 @@
       }
   
       /**
  -     * Initialises the project.
  +     * Initialise the project.
        *
        * This involves setting the default task definitions and loading the
        * system properties.
        *
  -     * @exception BuildException if the default task list cannot be loaded
  +     * @exception BuildException if the default task list cannot be loaded.
        */
       public void init() throws BuildException {
           setJavaVersionProperty();
  @@ -270,46 +263,22 @@
       }
   
       /**
  -     * Factory method to create a class loader for loading classes
  -     *
  -     * @return an appropriate classloader
  -     */
  -    private AntClassLoader createClassLoader() {
  -        AntClassLoader loader = null;
  -        try {
  -            // 1.2+ - create advanced helper dynamically
  -            Class loaderClass
  -                    = Class.forName(ANTCLASSLOADER_JDK12);
  -            loader = (AntClassLoader) loaderClass.newInstance();
  -        } catch (Exception e) {
  -            log("Unable to create Class Loader: "
  -                    + e.getMessage(), Project.MSG_DEBUG);
  -        }
  -
  -        if (loader == null) {
  -            loader = new AntClassLoader();
  -        }
  -
  -        loader.setProject(this);
  -        return loader;
  -    }
  -
  -    /**
        * Factory method to create a class loader for loading classes from
  -     * a given path
  +     * a given path.
        *
        * @param path the path from which classes are to be loaded.
        *
  -     * @return an appropriate classloader
  +     * @return an appropriate classloader.
        */
       public AntClassLoader createClassLoader(Path path) {
  -        AntClassLoader loader = createClassLoader();
  +        AntClassLoader loader = new AntClassLoader2();
  +        loader.setProject(this);
           loader.setClassPath(path);
           return loader;
       }
   
       /**
  -     * Sets the core classloader for the project. If a <code>null</code>
  +     * Set the core classloader for the project. If a <code>null</code>
        * classloader is specified, the parent classloader should be used.
        *
        * @param coreLoader The classloader to use for the project.
  @@ -320,7 +289,7 @@
       }
   
       /**
  -     * Returns the core classloader to use for this project.
  +     * Return the core classloader to use for this project.
        * This may be <code>null</code>, indicating that
        * the parent classloader should be used.
        *
  @@ -332,7 +301,7 @@
       }
   
       /**
  -     * Adds a build listener to the list. This listener will
  +     * Add a build listener to the list. This listener will
        * be notified of build events for this project.
        *
        * @param listener The listener to add to the list.
  @@ -347,7 +316,7 @@
       }
   
       /**
  -     * Removes a build listener from the list. This listener
  +     * Remove a build listener from the list. This listener
        * will no longer be notified of build events for this project.
        *
        * @param listener The listener to remove from the list.
  @@ -362,7 +331,7 @@
       }
   
       /**
  -     * Returns a copy of the list of build listeners for the project.
  +     * Return a copy of the list of build listeners for the project.
        *
        * @return a list of build listeners for the project
        */
  @@ -371,8 +340,8 @@
       }
   
       /**
  -     * Writes a message to the log with the default log level
  -     * of MSG_INFO
  +     * Write a message to the log with the default log level
  +     * of MSG_INFO .
        * @param message The text to log. Should not be <code>null</code>.
        */
   
  @@ -381,46 +350,46 @@
       }
   
       /**
  -     * Writes a project level message to the log with the given log level.
  +     * Write a project level message to the log with the given log level.
        * @param message The text to log. Should not be <code>null</code>.
  -     * @param msgLevel The priority level to log at.
  +     * @param msgLevel The log priority level to use.
        */
       public void log(String message, int msgLevel) {
           fireMessageLogged(this, message, msgLevel);
       }
   
       /**
  -     * Writes a task level message to the log with the given log level.
  +     * Write a task level message to the log with the given log level.
        * @param task The task to use in the log. Must not be <code>null</code>.
        * @param message The text to log. Should not be <code>null</code>.
  -     * @param msgLevel The priority level to log at.
  +     * @param msgLevel The log priority level to use.
        */
       public void log(Task task, String message, int msgLevel) {
           fireMessageLogged(task, message, msgLevel);
       }
   
       /**
  -     * Writes a target level message to the log with the given log level.
  +     * Write a target level message to the log with the given log level.
        * @param target The target to use in the log.
        *               Must not be <code>null</code>.
        * @param message The text to log. Should not be <code>null</code>.
  -     * @param msgLevel The priority level to log at.
  +     * @param msgLevel The log priority level to use.
        */
       public void log(Target target, String message, int msgLevel) {
           fireMessageLogged(target, message, msgLevel);
       }
   
       /**
  -     * Returns the set of global filters.
  +     * Return the set of global filters.
        *
  -     * @return the set of global filters
  +     * @return the set of global filters.
        */
       public FilterSet getGlobalFilterSet() {
           return globalFilterSet;
       }
   
       /**
  -     * Sets a property. Any existing property of the same name
  +     * Set a property. Any existing property of the same name
        * is overwritten, unless it is a user property.
        * @param name The name of property to set.
        *             Must not be <code>null</code>.
  @@ -433,7 +402,7 @@
       }
   
       /**
  -     * Sets a property if no value currently exists. If the property
  +     * Set a property if no value currently exists. If the property
        * exists already, a message is logged and the method returns with
        * no other effect.
        *
  @@ -449,7 +418,7 @@
       }
   
       /**
  -     * Sets a user property, which cannot be overwritten by
  +     * Set a user property, which cannot be overwritten by
        * set/unset property calls. Any previous value is overwritten.
        * @param name The name of property to set.
        *             Must not be <code>null</code>.
  @@ -463,7 +432,7 @@
       }
   
       /**
  -     * Sets a user property, which cannot be overwritten by set/unset
  +     * Set a user property, which cannot be overwritten by set/unset
        * property calls. Any previous value is overwritten. Also marks
        * these properties as properties that have not come from the
        * command line.
  @@ -480,7 +449,7 @@
       }
   
       /**
  -     * Sets a property unless it is already defined as a user property
  +     * Set a property unless it is already defined as a user property
        * (in which case the method returns silently).
        *
        * @param name The name of the property.
  @@ -493,7 +462,7 @@
       }
   
       /**
  -     * Returns the value of a property, if it is set.
  +     * Return the value of a property, if it is set.
        *
        * @param name The name of the property.
        *             May be <code>null</code>, in which case
  @@ -507,7 +476,7 @@
       }
   
       /**
  -     * Replaces ${} style constructions in the given value with the
  +     * Replace ${} style constructions in the given value with the
        * string value of the corresponding data types.
        *
        * @param value The string to be scanned for property references.
  @@ -518,7 +487,7 @@
        *         <code>null</code>.
        *
        * @exception BuildException if the given value has an unclosed
  -     *                           property name, e.g. <code>${xxx</code>
  +     *                           property name, e.g. <code>${xxx</code>.
        */
       public String replaceProperties(String value)
           throws BuildException {
  @@ -527,7 +496,7 @@
       }
   
       /**
  -     * Returns the value of a user property, if it is set.
  +     * Return the value of a user property, if it is set.
        *
        * @param name The name of the property.
        *             May be <code>null</code>, in which case
  @@ -541,7 +510,7 @@
       }
   
       /**
  -     * Returns a copy of the properties table.
  +     * Return a copy of the properties table.
        * @return a hashtable containing all properties
        *         (including user properties).
        */
  @@ -551,8 +520,8 @@
       }
   
       /**
  -     * Returns a copy of the user property hashtable
  -     * @return a hashtable containing just the user properties
  +     * Return a copy of the user property hashtable.
  +     * @return a hashtable containing just the user properties.
        */
       public Hashtable getUserProperties() {
           PropertyHelper ph = PropertyHelper.getPropertyHelper(this);
  @@ -560,11 +529,11 @@
       }
   
       /**
  -     * Copies all user properties that have been set on the command
  +     * Copy all user properties that have been set on the command
        * line or a GUI tool from this instance to the Project instance
        * given as the argument.
        *
  -     * <p>To copy all "user" properties, you will also have to call
  +     * <p>To copy all &quot;user&quot; properties, you will also have to call
        * [EMAIL PROTECTED] #copyInheritedProperties 
copyInheritedProperties}.</p>
        *
        * @param other the project to copy the properties to.  Must not be null.
  @@ -577,11 +546,11 @@
       }
   
       /**
  -     * Copies all user properties that have not been set on the
  +     * Copy all user properties that have not been set on the
        * command line or a GUI tool from this instance to the Project
        * instance given as the argument.
        *
  -     * <p>To copy all "user" properties, you will also have to call
  +     * <p>To copy all &quot;user&quot; properties, you will also have to call
        * [EMAIL PROTECTED] #copyUserProperties copyUserProperties}.</p>
        *
        * @param other the project to copy the properties to.  Must not be null.
  @@ -594,7 +563,7 @@
       }
   
       /**
  -     * Sets the default target of the project.
  +     * Set the default target of the project.
        *
        * @param defaultTarget The name of the default target for this project.
        *                      May be <code>null</code>, indicating that there 
is
  @@ -608,7 +577,7 @@
       }
   
       /**
  -     * Returns the name of the default target of the project.
  +     * Return the name of the default target of the project.
        * @return name of the default target or
        *         <code>null</code> if no default has been set.
        */
  @@ -617,7 +586,7 @@
       }
   
       /**
  -     * Sets the default target of the project.
  +     * Set the default target of the project.
        *
        * @param defaultTarget The name of the default target for this project.
        *                      May be <code>null</code>, indicating that there 
is
  @@ -628,7 +597,7 @@
       }
   
       /**
  -     * Sets the name of the project, also setting the user
  +     * Set the name of the project, also setting the user
        * property <code>ant.project.name</code>.
        *
        * @param name The name of the project.
  @@ -640,7 +609,7 @@
       }
   
       /**
  -     * Returns the project name, if one has been set.
  +     * Return the project name, if one has been set.
        *
        * @return the project name, or <code>null</code> if it hasn't been set.
        */
  @@ -649,7 +618,7 @@
       }
   
       /**
  -     * Sets the project description.
  +     * Set the project description.
        *
        * @param description The description of the project.
        *                    May be <code>null</code>.
  @@ -659,7 +628,7 @@
       }
   
       /**
  -     * Returns the project description, if one has been set.
  +     * Return the project description, if one has been set.
        *
        * @return the project description, or <code>null</code> if it hasn't
        *         been set.
  @@ -668,12 +637,11 @@
           if (description == null) {
               description = Description.getDescription(this);
           }
  -
           return description;
       }
   
       /**
  -     * Adds a filter to the set of global filters.
  +     * Add a filter to the set of global filters.
        *
        * @param token The token to filter.
        *              Must not be <code>null</code>.
  @@ -688,12 +656,11 @@
           if (token == null) {
               return;
           }
  -
           globalFilterSet.addFilter(new FilterSet.Filter(token, value));
       }
   
       /**
  -     * Returns a hashtable of global filters, mapping tokens to values.
  +     * Return a hashtable of global filters, mapping tokens to values.
        *
        * @return a hashtable of global filters, mapping tokens to values
        *         (String to String).
  @@ -709,29 +676,29 @@
       }
   
       /**
  -     * Sets the base directory for the project, checking that
  +     * Set the base directory for the project, checking that
        * the given filename exists and is a directory.
        *
        * @param baseD The project base directory.
        *              Must not be <code>null</code>.
        *
  -     * @exception BuildException if the directory if invalid
  +     * @exception BuildException if the directory if invalid.
        */
       public void setBasedir(String baseD) throws BuildException {
           setBaseDir(new File(baseD));
       }
   
       /**
  -     * Sets the base directory for the project, checking that
  +     * Set the base directory for the project, checking that
        * the given file exists and is a directory.
        *
        * @param baseDir The project base directory.
        *                Must not be <code>null</code>.
        * @exception BuildException if the specified file doesn't exist or
  -     *                           isn't a directory
  +     *                           isn't a directory.
        */
       public void setBaseDir(File baseDir) throws BuildException {
  -        baseDir = fileUtils.normalize(baseDir.getAbsolutePath());
  +        baseDir = FILE_UTILS.normalize(baseDir.getAbsolutePath());
           if (!baseDir.exists()) {
               throw new BuildException("Basedir " + baseDir.getAbsolutePath()
                   + " does not exist");
  @@ -747,7 +714,7 @@
       }
   
       /**
  -     * Returns the base directory of the project as a file object.
  +     * Return the base directory of the project as a file object.
        *
        * @return the project base directory, or <code>null</code> if the
        *         base directory has not been successfully set to a valid value.
  @@ -764,12 +731,12 @@
       }
   
       /**
  -     * Sets "keep-going" mode. In this mode ANT will try to execute
  +     * Set &quot;keep-going&quot; mode. In this mode Ant will try to execute
        * as many targets as possible. All targets that do not depend
        * on failed target(s) will be executed.  If the keepGoing settor/getter
        * methods are used in conjunction with the 
<code>ant.executor.class</code>
        * property, they will have no effect.
  -     * @param keepGoingMode "keep-going" mode
  +     * @param keepGoingMode &quot;keep-going&quot; mode
        * @since Ant 1.6
        */
       public void setKeepGoingMode(boolean keepGoingMode) {
  @@ -777,10 +744,10 @@
       }
   
       /**
  -     * Returns the keep-going mode.  If the keepGoing settor/getter
  +     * Return the keep-going mode.  If the keepGoing settor/getter
        * methods are used in conjunction with the 
<code>ant.executor.class</code>
        * property, they will have no effect.
  -     * @return "keep-going" mode
  +     * @return &quot;keep-going&quot; mode
        * @since Ant 1.6
        */
       public boolean isKeepGoingMode() {
  @@ -788,8 +755,8 @@
       }
   
       /**
  -     * Returns the version of Java this class is running under.
  -     * @return the version of Java as a String, e.g. "1.1"
  +     * Return the version of Java this class is running under.
  +     * @return the version of Java as a String, e.g. "1.1" .
        * @see org.apache.tools.ant.util.JavaEnvUtils#getJavaVersion
        * @deprecated use org.apache.tools.ant.util.JavaEnvUtils instead
        */
  @@ -798,12 +765,12 @@
       }
   
       /**
  -     * Sets the <code>ant.java.version</code> property and tests for
  +     * Set the <code>ant.java.version</code> property and tests for
        * unsupported JVM versions. If the version is supported,
        * verbose log messages are generated to record the Java version
        * and operating system name.
        *
  -     * @exception BuildException if this Java version is not supported
  +     * @exception BuildException if this Java version is not supported.
        *
        * @see org.apache.tools.ant.util.JavaEnvUtils#getJavaVersion
        */
  @@ -815,7 +782,6 @@
           if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_0)) {
               throw new BuildException("Ant cannot work on Java 1.0");
           }
  -
           log("Detected Java version: " + javaVersion + " in: "
               + System.getProperty("java.home"), MSG_VERBOSE);
   
  @@ -823,21 +789,21 @@
       }
   
       /**
  -     * Adds all system properties which aren't already defined as
  +     * Add all system properties which aren't already defined as
        * user properties to the project properties.
        */
       public void setSystemProperties() {
           Properties systemP = System.getProperties();
           Enumeration e = systemP.propertyNames();
           while (e.hasMoreElements()) {
  -            String name = (String) e.nextElement();
  -            String value = systemP.getProperty(name);
  -            this.setPropertyInternal(name.toString(), value);
  +            String propertyName = (String) e.nextElement();
  +            String value = systemP.getProperty(propertyName);
  +            this.setPropertyInternal(propertyName, value);
           }
       }
   
       /**
  -     * Adds a new task definition to the project.
  +     * Add a new task definition to the project.
        * Attempting to override an existing definition with an
        * equivalent one (i.e. with the same classname) results in
        * a verbose log message. Attempting to override an existing definition
  @@ -863,7 +829,7 @@
       }
   
       /**
  -     * Checks whether or not a class is suitable for serving as Ant task.
  +     * Check whether or not a class is suitable for serving as Ant task.
        * Ant task implementation classes must be public, concrete, and have
        * a no-arg constructor.
        *
  @@ -888,7 +854,7 @@
               throw new BuildException(message);
           }
           try {
  -            taskClass.getConstructor(null);
  +            taskClass.getConstructor((Class[]) null);
               // don't have to check for public, since
               // getConstructor finds public constructors only.
           } catch (NoSuchMethodException e) {
  @@ -907,8 +873,8 @@
       }
   
       /**
  -     * Returns the current task definition hashtable. The returned hashtable 
is
  -     * "live" and so should not be modified.
  +     * Return the current task definition hashtable. The returned hashtable 
is
  +     * &quot;live&quot; and so should not be modified.
        *
        * @return a map of from task name to implementing class
        *         (String to Class).
  @@ -918,7 +884,7 @@
       }
   
       /**
  -     * Adds a new datatype definition.
  +     * Add a new datatype definition.
        * Attempting to override an existing definition with an
        * equivalent one (i.e. with the same classname) results in
        * a verbose log message. Attempting to override an existing definition
  @@ -936,8 +902,8 @@
       }
   
       /**
  -     * Returns the current datatype definition hashtable. The returned
  -     * hashtable is "live" and so should not be modified.
  +     * Return the current datatype definition hashtable. The returned
  +     * hashtable is &quot;live&quot; and so should not be modified.
        *
        * @return a map of from datatype name to implementing class
        *         (String to Class).
  @@ -947,7 +913,7 @@
       }
   
       /**
  -     * Adds a <em>new</em> target to the project.
  +     * Add a <em>new</em> target to the project.
        *
        * @param target The target to be added to the project.
        *               Must not be <code>null</code>.
  @@ -961,14 +927,14 @@
       }
   
       /**
  -     * Adds a <em>new</em> target to the project.
  +     * Add a <em>new</em> target to the project.
        *
        * @param targetName The name to use for the target.
        *             Must not be <code>null</code>.
        * @param target The target to be added to the project.
        *               Must not be <code>null</code>.
        *
  -     * @exception BuildException if the target already exists in the project
  +     * @exception BuildException if the target already exists in the project.
        *
        * @see Project#addOrReplaceTarget
        */
  @@ -981,7 +947,7 @@
        }
   
       /**
  -     * Adds a target to the project, or replaces one with the same
  +     * Add a target to the project, or replaces one with the same
        * name.
        *
        * @param target The target to be added or replaced in the project.
  @@ -992,7 +958,7 @@
       }
   
       /**
  -     * Adds a target to the project, or replaces one with the same
  +     * Add a target to the project, or replaces one with the same
        * name.
        *
        * @param targetName The name to use for the target.
  @@ -1008,8 +974,8 @@
       }
   
       /**
  -     * Returns the hashtable of targets. The returned hashtable
  -     * is "live" and so should not be modified.
  +     * Return the hashtable of targets. The returned hashtable
  +     * is &quot;live&quot; and so should not be modified.
        * @return a map from name to target (String to Target).
        */
       public Hashtable getTargets() {
  @@ -1017,7 +983,7 @@
       }
   
       /**
  -     * Creates a new instance of a task, adding it to a list of
  +     * Create a new instance of a task, adding it to a list of
        * created tasks for later invalidation. This causes all tasks
        * to be remembered until the containing project is removed
        * @param taskType The name of the task to create an instance of.
  @@ -1034,7 +1000,7 @@
       }
   
       /**
  -     * Creates a new instance of a data type.
  +     * Create a new instance of a data type.
        *
        * @param typeName The name of the data type to create an instance of.
        *                 Must not be <code>null</code>.
  @@ -1056,7 +1022,7 @@
        * @param targetNames A vector of target name strings to execute.
        *                    Must not be <code>null</code>.
        *
  -     * @exception BuildException if the build failed
  +     * @exception BuildException if the build failed.
        */
       public void executeTargets(Vector targetNames) throws BuildException {
   
  @@ -1085,18 +1051,17 @@
                   addReference("ant.executor", o);
               }
           }
  -
           if (o == null) {
               throw new BuildException("Unable to obtain a Target Executor 
instance.");
           } else {
  -            String[] targetNameArray = (String[])(targetNames.toArray(
  +            String[] targetNameArray = (String[]) (targetNames.toArray(
                   new String[targetNames.size()]));
  -            ((Executor)o).executeTargets(this, targetNameArray);
  +            ((Executor) o).executeTargets(this, targetNameArray);
           }
       }
   
       /**
  -     * Demultiplexes output so that each task receives the appropriate
  +     * Demultiplex output so that each task receives the appropriate
        * messages. If the current thread is not currently executing a task,
        * the message is logged directly.
        *
  @@ -1123,11 +1088,11 @@
        *
        * @param buffer the buffer into which data is to be read.
        * @param offset the offset into the buffer at which data is stored.
  -     * @param length the amount of data to read
  +     * @param length the amount of data to read.
        *
  -     * @return the number of bytes read
  +     * @return the number of bytes read.
        *
  -     * @exception IOException if the data cannot be read
  +     * @exception IOException if the data cannot be read.
        * @since Ant 1.6
        */
       public int defaultInput(byte[] buffer, int offset, int length)
  @@ -1145,11 +1110,11 @@
        *
        * @param buffer the buffer into which data is to be read.
        * @param offset the offset into the buffer at which data is stored.
  -     * @param length the amount of data to read
  +     * @param length the amount of data to read.
        *
  -     * @return the number of bytes read
  +     * @return the number of bytes read.
        *
  -     * @exception IOException if the data cannot be read
  +     * @exception IOException if the data cannot be read.
        * @since Ant 1.6
        */
       public int demuxInput(byte[] buffer, int offset, int length)
  @@ -1163,7 +1128,7 @@
       }
   
       /**
  -     * Demultiplexes flush operation so that each task receives the 
appropriate
  +     * Demultiplex flush operations so that each task receives the 
appropriate
        * messages. If the current thread is not currently executing a task,
        * the message is logged directly.
        *
  @@ -1186,15 +1151,13 @@
           }
       }
   
  -
  -
       /**
  -     * Executes the specified target and any targets it depends on.
  +     * Execute the specified target and any targets it depends on.
        *
        * @param targetName The name of the target to execute.
        *                   Must not be <code>null</code>.
        *
  -     * @exception BuildException if the build failed
  +     * @exception BuildException if the build failed.
        */
       public void executeTarget(String targetName) throws BuildException {
   
  @@ -1214,8 +1177,9 @@
       }
   
       /**
  -     * Executes a <code>Vector</code> of sorted targets.
  +     * Execute a <code>Vector</code> of sorted targets.
        * @param sortedTargets   the aforementioned <code>Vector</code>.
  +     * @throws BuildException on error.
        */
       public void executeSortedTargets(Vector sortedTargets)
           throws BuildException {
  @@ -1283,7 +1247,7 @@
       }
   
       /**
  -     * Returns the canonical form of a filename.
  +     * Return the canonical form of a filename.
        * <p>
        * If the specified file name is relative it is resolved
        * with respect to the given root directory.
  @@ -1291,8 +1255,8 @@
        * @param fileName The name of the file to resolve.
        *                 Must not be <code>null</code>.
        *
  -     * @param rootDir  The directory to resolve relative file names with
  -     *                 respect to. May be <code>null</code>, in which case
  +     * @param rootDir  The directory respective to which relative file names
  +     *                 are resolved. May be <code>null</code>, in which case
        *                 the current directory is used.
        *
        * @return the resolved File.
  @@ -1300,11 +1264,11 @@
        * @deprecated
        */
       public File resolveFile(String fileName, File rootDir) {
  -        return fileUtils.resolveFile(rootDir, fileName);
  +        return FILE_UTILS.resolveFile(rootDir, fileName);
       }
   
       /**
  -     * Returns the canonical form of a filename.
  +     * Return the canonical form of a filename.
        * <p>
        * If the specified file name is relative it is resolved
        * with respect to the project's base directory.
  @@ -1316,11 +1280,11 @@
        *
        */
       public File resolveFile(String fileName) {
  -        return fileUtils.resolveFile(baseDir, fileName);
  +        return FILE_UTILS.resolveFile(baseDir, fileName);
       }
   
       /**
  -     * Translates a path into its native (platform specific) format.
  +     * Translate a path into its native (platform specific) format.
        * <p>
        * This method uses PathTokenizer to separate the input path
        * into its components. This handles DOS style paths in a relatively
  @@ -1339,7 +1303,6 @@
           if (toProcess == null || toProcess.length() == 0) {
               return "";
           }
  -
           StringBuffer path = new StringBuffer(toProcess.length() + 50);
           PathTokenizer tokenizer = new PathTokenizer(toProcess);
           while (tokenizer.hasMoreTokens()) {
  @@ -1351,7 +1314,6 @@
               }
               path.append(pathComponent);
           }
  -
           return path.toString();
       }
   
  @@ -1364,13 +1326,13 @@
        * @param destFile Name of file to copy to.
        *                 Must not be <code>null</code>.
        *
  -     * @exception IOException if the copying fails
  +     * @exception IOException if the copying fails.
        *
        * @deprecated
        */
       public void copyFile(String sourceFile, String destFile)
             throws IOException {
  -        fileUtils.copyFile(sourceFile, destFile);
  +        FILE_UTILS.copyFile(sourceFile, destFile);
       }
   
       /**
  @@ -1384,13 +1346,13 @@
        * @param filtering Whether or not token filtering should be used during
        *                  the copy.
        *
  -     * @exception IOException if the copying fails
  +     * @exception IOException if the copying fails.
        *
        * @deprecated
        */
       public void copyFile(String sourceFile, String destFile, boolean 
filtering)
           throws IOException {
  -        fileUtils.copyFile(sourceFile, destFile,
  +        FILE_UTILS.copyFile(sourceFile, destFile,
               filtering ? globalFilters : null);
       }
   
  @@ -1408,13 +1370,13 @@
        * @param overwrite Whether or not the destination file should be
        *                  overwritten if it already exists.
        *
  -     * @exception IOException if the copying fails
  +     * @exception IOException if the copying fails.
        *
        * @deprecated
        */
       public void copyFile(String sourceFile, String destFile, boolean 
filtering,
                            boolean overwrite) throws IOException {
  -        fileUtils.copyFile(sourceFile, destFile,
  +        FILE_UTILS.copyFile(sourceFile, destFile,
               filtering ? globalFilters : null, overwrite);
       }
   
  @@ -1437,14 +1399,14 @@
        *                             the resulting file should be set to that
        *                             of the source file.
        *
  -     * @exception IOException if the copying fails
  +     * @exception IOException if the copying fails.
        *
        * @deprecated
        */
       public void copyFile(String sourceFile, String destFile, boolean 
filtering,
                            boolean overwrite, boolean preserveLastModified)
           throws IOException {
  -        fileUtils.copyFile(sourceFile, destFile,
  +        FILE_UTILS.copyFile(sourceFile, destFile,
               filtering ? globalFilters : null, overwrite, 
preserveLastModified);
       }
   
  @@ -1457,12 +1419,12 @@
        * @param destFile File to copy to.
        *                 Must not be <code>null</code>.
        *
  -     * @exception IOException if the copying fails
  +     * @exception IOException if the copying fails.
        *
        * @deprecated
        */
       public void copyFile(File sourceFile, File destFile) throws IOException {
  -        fileUtils.copyFile(sourceFile, destFile);
  +        FILE_UTILS.copyFile(sourceFile, destFile);
       }
   
       /**
  @@ -1476,13 +1438,13 @@
        * @param filtering Whether or not token filtering should be used during
        *                  the copy.
        *
  -     * @exception IOException if the copying fails
  +     * @exception IOException if the copying fails.
        *
        * @deprecated
        */
       public void copyFile(File sourceFile, File destFile, boolean filtering)
           throws IOException {
  -        fileUtils.copyFile(sourceFile, destFile,
  +        FILE_UTILS.copyFile(sourceFile, destFile,
               filtering ? globalFilters : null);
       }
   
  @@ -1506,7 +1468,7 @@
        */
       public void copyFile(File sourceFile, File destFile, boolean filtering,
                            boolean overwrite) throws IOException {
  -        fileUtils.copyFile(sourceFile, destFile,
  +        FILE_UTILS.copyFile(sourceFile, destFile,
               filtering ? globalFilters : null, overwrite);
       }
   
  @@ -1536,12 +1498,12 @@
       public void copyFile(File sourceFile, File destFile, boolean filtering,
                            boolean overwrite, boolean preserveLastModified)
           throws IOException {
  -        fileUtils.copyFile(sourceFile, destFile,
  +        FILE_UTILS.copyFile(sourceFile, destFile,
               filtering ? globalFilters : null, overwrite, 
preserveLastModified);
       }
   
       /**
  -     * Calls File.setLastModified(long time) on Java above 1.1, and logs
  +     * Call File.setLastModified(long time) on Java above 1.1, and logs
        * a warning on Java 1.1.
        *
        * @param file The file to set the last modified time on.
  @@ -1557,12 +1519,12 @@
        */
       public void setFileLastModified(File file, long time)
            throws BuildException {
  -        fileUtils.setFileLastModified(file, time);
  +        FILE_UTILS.setFileLastModified(file, time);
           log("Setting modification time for " + file, MSG_VERBOSE);
       }
   
       /**
  -     * Returns the boolean equivalent of a string, which is considered
  +     * Return the boolean equivalent of a string, which is considered
        * <code>true</code> if either <code>"on"</code>, <code>"true"</code>,
        * or <code>"yes"</code> is found, ignoring case.
        *
  @@ -1579,7 +1541,7 @@
       }
   
       /**
  -     * Topologically sorts a set of targets.  Equivalent to calling
  +     * Topologically sort a set of targets.  Equivalent to calling
        * <code>topoSort(new String[] {root}, targets, true)</code>.
        *
        * @param root The name of the root target. The sort is created in such
  @@ -1598,7 +1560,7 @@
       }
   
       /**
  -     * Topologically sorts a set of targets.  Equivalent to calling
  +     * Topologically sort a set of targets.  Equivalent to calling
        * <code>topoSort(new String[] {root}, targets, returnAll)</code>.
        *
        * @param root The name of the root target. The sort is created in such
  @@ -1620,7 +1582,7 @@
       }
   
       /**
  -     * Topologically sorts a set of targets.
  +     * Topologically sort a set of targets.
        *
        * @param root <code>String[]</code> containing the names of the root 
targets.
        *             The sort is created in such a way that the ordered 
sequence of
  @@ -1651,7 +1613,7 @@
           // build Target.
   
           for (int i = 0; i < root.length; i++) {
  -            String st = (String)(state.get(root[i]));
  +            String st = (String) (state.get(root[i]));
               if (st == null) {
                   tsort(root[i], targets, state, visiting, ret);
               } else if (st == VISITING) {
  @@ -1683,23 +1645,24 @@
       }
   
       /**
  -     * Performs a single step in a recursive depth-first-search traversal of
  +     * Perform a single step in a recursive depth-first-search traversal of
        * the target dependency tree.
        * <p>
  -     * The current target is first set to the "visiting" state, and pushed
  -     * onto the "visiting" stack.
  +     * The current target is first set to the &quot;visiting&quot; state, and
  +     * pushed onto the &quot;visiting&quot; stack.
        * <p>
        * An exception is then thrown if any child of the current node is in the
        * visiting state, as that implies a circular dependency. The exception
  -     * contains details of the cycle, using elements of the "visiting" stack.
  +     * contains details of the cycle, using elements of the 
&quot;visiting&quot;
  +     * stack.
        * <p>
  -     * If any child has not already been "visited", this method is called
  -     * recursively on it.
  +     * If any child has not already been &quot;visited&quot;, this method is
  +     * called recursively on it.
        * <p>
        * The current target is then added to the ordered list of targets. Note
        * that this is performed after the children have been visited in order
  -     * to get the correct order. The current target is set to the "visited"
  -     * state.
  +     * to get the correct order. The current target is set to the
  +     * &quot;visited&quot; state.
        * <p>
        * By the time this method returns, the ordered list contains the 
sequence
        * of targets up to and including the current target.
  @@ -1708,10 +1671,9 @@
        *             Must not be <code>null</code>.
        * @param targets A mapping from names to targets (String to Target).
        *                Must not be <code>null</code>.
  -     * @param state   A mapping from target names to states
  -     *                (String to String).
  -     *                The states in question are "VISITING" and "VISITED".
  -     *                Must not be <code>null</code>.
  +     * @param state   A mapping from target names to states (String to 
String).
  +     *                The states in question are &quot;VISITING&quot; and
  +     *                &quot;VISITED&quot;. Must not be <code>null</code>.
        * @param visiting A stack of targets which are currently being visited.
        *                 Must not be <code>null</code>.
        * @param ret     The list to add target names to. This will end up
  @@ -1722,7 +1684,7 @@
        * @exception BuildException if a non-existent target is specified or if
        *                           a circular dependency is detected.
        */
  -    private final void tsort(String root, Hashtable targets,
  +    private void tsort(String root, Hashtable targets,
                                Hashtable state, Stack visiting,
                                Vector ret)
           throws BuildException {
  @@ -1743,10 +1705,8 @@
                   sb.append(parent);
                   sb.append("'.");
               }
  -
               throw new BuildException(new String(sb));
           }
  -
           for (Enumeration en = target.getDependencies(); 
en.hasMoreElements();) {
               String cur = (String) en.nextElement();
               String m = (String) state.get(cur);
  @@ -1758,7 +1718,6 @@
                   throw makeCircularException(cur, visiting);
               }
           }
  -
           String p = (String) visiting.pop();
           if (root != p) {
               throw new RuntimeException("Unexpected internal error: expected 
to "
  @@ -1769,7 +1728,7 @@
       }
   
       /**
  -     * Builds an appropriate exception detailing a specified circular
  +     * Build an appropriate exception detailing a specified circular
        * dependency.
        *
        * @param end The dependency to stop at. Must not be <code>null</code>.
  @@ -1790,7 +1749,7 @@
       }
   
       /**
  -     * Adds a reference to the project.
  +     * Add a reference to the project.
        *
        * @param name The name of the reference. Must not be <code>null</code>.
        * @param value The value of the reference. Must not be 
<code>null</code>.
  @@ -1812,8 +1771,8 @@
       }
   
       /**
  -     * Returns a map of the references in the project (String to Object).
  -     * The returned hashtable is "live" and so must not be modified.
  +     * Return a map of the references in the project (String to Object).
  +     * The returned hashtable is &quot;live&quot; and so must not be 
modified.
        *
        * @return a map of the references in the project (String to Object).
        */
  @@ -1822,7 +1781,7 @@
       }
   
       /**
  -     * Looks up a reference by its key (ID).
  +     * Look up a reference by its key (ID).
        *
        * @param key The key for the desired reference.
        *            Must not be <code>null</code>.
  @@ -1835,7 +1794,7 @@
       }
   
       /**
  -     * Returns a description of the type of the given element, with
  +     * Return a description of the type of the given element, with
        * special handling for instances of tasks and data types.
        * <p>
        * This is useful for logging purposes.
  @@ -1843,7 +1802,7 @@
        * @param element The element to describe.
        *                Must not be <code>null</code>.
        *
  -     * @return a description of the element type
  +     * @return a description of the element type.
        *
        * @since 1.95, Ant 1.5
        */
  @@ -1852,7 +1811,8 @@
       }
   
       /**
  -     * Sends a "build started" event to the build listeners for this project.
  +     * Send a &quot;build started&quot; event
  +     * to the build listeners for this project.
        */
       public void fireBuildStarted() {
           BuildEvent event = new BuildEvent(this);
  @@ -1864,7 +1824,8 @@
       }
   
       /**
  -     * Sends a "build finished" event to the build listeners for this 
project.
  +     * Send a &quot;build finished&quot; event to the build listeners
  +     * for this project.
        * @param exception an exception indicating a reason for a build
        *                  failure. May be <code>null</code>, indicating
        *                  a successful build.
  @@ -1880,7 +1841,7 @@
       }
   
       /**
  -     * Sends a "subbuild started" event to the build listeners for
  +     * Send a &quot;subbuild started&quot; event to the build listeners for
        * this project.
        *
        * @since Ant 1.6.2
  @@ -1897,7 +1858,7 @@
       }
   
       /**
  -     * Sends a "subbuild finished" event to the build listeners for
  +     * Send a &quot;subbuild finished&quot; event to the build listeners for
        * this project.
        * @param exception an exception indicating a reason for a build
        *                  failure. May be <code>null</code>, indicating
  @@ -1918,7 +1879,8 @@
       }
   
       /**
  -     * Sends a "target started" event to the build listeners for this 
project.
  +     * Send a &quot;target started&quot; event to the build listeners
  +     * for this project.
        *
        * @param target The target which is starting to build.
        *               Must not be <code>null</code>.
  @@ -1933,8 +1895,8 @@
       }
   
       /**
  -     * Sends a "target finished" event to the build listeners for this
  -     * project.
  +     * Send a &quot;target finished&quot; event to the build listeners
  +     * for this project.
        *
        * @param target    The target which has finished building.
        *                  Must not be <code>null</code>.
  @@ -1953,7 +1915,8 @@
       }
   
       /**
  -     * Sends a "task started" event to the build listeners for this project.
  +     * Send a &quot;task started&quot; event to the build listeners
  +     * for this project.
        *
        * @param task The target which is starting to execute.
        *               Must not be <code>null</code>.
  @@ -1970,7 +1933,7 @@
       }
   
       /**
  -     * Sends a "task finished" event to the build listeners for this
  +     * Send a &quot;task finished&quot; event to the build listeners for this
        * project.
        *
        * @param task      The task which has finished executing.
  @@ -1993,7 +1956,8 @@
       }
   
       /**
  -     * Sends a "message logged" event to the build listeners for this 
project.
  +     * Send a &quot;message logged&quot; event to the build listeners
  +     * for this project.
        *
        * @param event    The event to send. This should be built up with the
        *                 appropriate task/target/project by the caller, so that
  @@ -2013,7 +1977,7 @@
           }
           synchronized (this) {
               if (loggingMessage) {
  -                /* 
  +                /*
                    * One of the Listeners has attempted to access
                    * System.err or System.out.
                    *
  @@ -2042,8 +2006,8 @@
       }
   
       /**
  -     * Sends a "message logged" project level event to the build listeners 
for
  -     * this project.
  +     * Send a &quot;message logged&quot; project level event
  +     * to the build listeners for this project.
        *
        * @param project  The project generating the event.
        *                 Should not be <code>null</code>.
  @@ -2057,8 +2021,8 @@
       }
   
       /**
  -     * Sends a "message logged" target level event to the build listeners for
  -     * this project.
  +     * Send a &quot;message logged&quot; target level event
  +     * to the build listeners for this project.
        *
        * @param target   The target generating the event.
        *                 Must not be <code>null</code>.
  @@ -2072,8 +2036,8 @@
       }
   
       /**
  -     * Sends a "message logged" task level event to the build listeners for
  -     * this project.
  +     * Send a &quot;message logged&quot; task level event
  +     * to the build listeners for this project.
        *
        * @param task     The task generating the event.
        *                 Must not be <code>null</code>.
  @@ -2104,7 +2068,7 @@
       }
   
       /**
  -     * Get the current task associated with a thread, if any
  +     * Get the current task associated with a thread, if any.
        *
        * @param thread the thread for which the task is required.
        * @return the task which is currently registered for the given thread or
  @@ -2135,10 +2099,10 @@
   
           /** Returns the unmodified original object.
            * This method should be called internally to
  -         * get the 'real' object.
  +         * get the &quot;real&quot; object.
            * The normal get method will do the replacement
  -         * of UnknownElement ( this is similar with the JDNI
  -         * refs behavior )
  +         * of UnknownElement (this is similar with the JDNI
  +         * refs behavior).
            */
           public Object getReal(Object key) {
               return super.get(key);
  @@ -2146,14 +2110,14 @@
   
           /** Get method for the reference table.
            *  It can be used to hook dynamic references and to modify
  -         * some references on the fly - for example for delayed
  +         * some references on the fly--for example for delayed
            * evaluation.
            *
            * It is important to make sure that the processing that is
            * done inside is not calling get indirectly.
            *
  -         * @param key
  -         * @return
  +         * @param key lookup key.
  +         * @return mapped value.
            */
           public Object get(Object key) {
               //System.out.println("AntRefTable.get " + key);
  @@ -2171,8 +2135,8 @@
       /**
        * Set a reference to this Project on the parameterized object.
        * Need to set the project before other set/add elements
  -     * are called
  -     * @param obj the object to invoke setProject(this) on
  +     * are called.
  +     * @param obj the object to invoke setProject(this) on.
        */
       public final void setProjectReference(final Object obj) {
           if (obj instanceof ProjectComponent) {
  
  
  

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

Reply via email to