You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by do...@apache.org on 2001/12/17 11:47:20 UTC

cvs commit: jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/util FileUtils.java SourceFileScanner.java

donaldp     01/12/17 02:47:20

  Modified:    proposal/myrmidon/src/main/org/apache/tools/ant
                        AntClassLoader.java Project.java
                        ProjectComponent.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs
                        Available.java Copy.java Expand.java FixCRLF.java
                        Javadoc.java Move.java Replace.java Rmic.java
                        Touch.java Untar.java Zip.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers
                        DefaultCompilerAdapter.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec
                        Execute.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional
                        Cab.java NetRexxC.java ReplaceRegExp.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb
                        WeblogicDeploymentTool.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/i18n
                        Translate.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit
                        AggregateTransformer.java XMLResultAggregator.java
               proposal/myrmidon/src/main/org/apache/tools/ant/types
                        Path.java
               proposal/myrmidon/src/main/org/apache/tools/ant/util
                        FileUtils.java SourceFileScanner.java
  Log:
  Start reducing the dependence on FileUtils.
  
  Revision  Changes    Path
  1.7       +2 -2      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/AntClassLoader.java
  
  Index: AntClassLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/AntClassLoader.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AntClassLoader.java	2001/12/16 06:23:07	1.6
  +++ AntClassLoader.java	2001/12/17 10:47:18	1.7
  @@ -21,9 +21,9 @@
   import java.util.Vector;
   import java.util.zip.ZipEntry;
   import java.util.zip.ZipFile;
  +import org.apache.avalon.excalibur.io.FileUtil;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.tools.ant.types.Path;
  -import org.apache.tools.ant.util.FileUtils;
   
   /**
    * Used to load classes within ant with a different claspath from that used to
  @@ -421,7 +421,7 @@
           throws TaskException
       {
           File pathComponent
  -            = project != null ? FileUtils.newFileUtils().resolveFile( project.getBaseDir(), pathElement )
  +            = project != null ? FileUtil.resolveFile( project.getBaseDir(), pathElement )
               : new File( pathElement );
           pathComponents.addElement( pathComponent );
       }
  
  
  
  1.10      +0 -3      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/Project.java
  
  Index: Project.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/Project.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Project.java	2001/12/16 06:44:16	1.9
  +++ Project.java	2001/12/17 10:47:18	1.10
  @@ -8,15 +8,12 @@
   package org.apache.tools.ant;
   
   import java.io.File;
  -import java.lang.reflect.Modifier;
   import java.util.Enumeration;
   import java.util.Hashtable;
  -import java.util.Stack;
   import java.util.Vector;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.tools.ant.types.FilterSet;
   import org.apache.tools.ant.types.FilterSetCollection;
  -import org.apache.tools.ant.util.FileUtils;
   
   /**
    * Central representation of an Ant project. This class defines a Ant project
  
  
  
  1.8       +0 -2      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/ProjectComponent.java
  
  Index: ProjectComponent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/ProjectComponent.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ProjectComponent.java	2001/12/16 06:43:49	1.7
  +++ ProjectComponent.java	2001/12/17 10:47:18	1.8
  @@ -7,10 +7,8 @@
    */
   package org.apache.tools.ant;
   
  -import java.io.File;
   import org.apache.myrmidon.api.AbstractTask;
   import org.apache.myrmidon.api.TaskException;
  -import org.apache.tools.ant.util.FileUtils;
   
   /**
    * Base class for components of a project, including tasks and data types.
  
  
  
  1.7       +0 -2      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Available.java
  
  Index: Available.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Available.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Available.java	2001/12/17 10:10:49	1.6
  +++ Available.java	2001/12/17 10:47:18	1.7
  @@ -16,7 +16,6 @@
   import org.apache.tools.ant.types.EnumeratedAttribute;
   import org.apache.tools.ant.types.Path;
   import org.apache.tools.ant.types.Reference;
  -import org.apache.tools.ant.util.FileUtils;
   
   /**
    * Will set the given property if the requested resource is available at
  @@ -274,7 +273,6 @@
                       return false;
                   }
   
  -                FileUtils fileUtils = FileUtils.newFileUtils();
                   File parent = path.getParentFile();
                   // **   full-pathname specified == parent dir of path in list
                   if( parent != null && parent.exists()
  
  
  
  1.7       +17 -18    jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Copy.java
  
  Index: Copy.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Copy.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Copy.java	2001/12/16 05:44:55	1.6
  +++ Copy.java	2001/12/17 10:47:18	1.7
  @@ -12,6 +12,7 @@
   import java.util.Enumeration;
   import java.util.Hashtable;
   import java.util.Vector;
  +import org.apache.avalon.excalibur.io.FileUtil;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.tools.ant.DirectoryScanner;
   import org.apache.tools.ant.Project;
  @@ -61,13 +62,7 @@
   
       protected Mapper mapperElement = null;
       private Vector filterSets = new Vector();
  -    private FileUtils fileUtils;
   
  -    public Copy()
  -    {
  -        fileUtils = FileUtils.newFileUtils();
  -    }
  -
       /**
        * Sets a single source file to copy.
        *
  @@ -277,11 +272,6 @@
           }
       }
   
  -    protected FileUtils getFileUtils()
  -    {
  -        return fileUtils;
  -    }
  -
       /**
        * Get the filtersets being applied to this operation.
        *
  @@ -335,8 +325,8 @@
           if( fileCopyMap.size() > 0 )
           {
               getLogger().info( "Copying " + fileCopyMap.size() +
  -                 " file" + ( fileCopyMap.size() == 1 ? "" : "s" ) +
  -                 " to " + destDir.getAbsolutePath() );
  +                              " file" + ( fileCopyMap.size() == 1 ? "" : "s" ) +
  +                              " to " + destDir.getAbsolutePath() );
   
               Enumeration e = fileCopyMap.keys();
               while( e.hasMoreElements() )
  @@ -362,9 +352,18 @@
                       for( Enumeration filterEnum = filterSets.elements(); filterEnum.hasMoreElements(); )
                       {
                           executionFilters.addFilterSet( (FilterSet)filterEnum.nextElement() );
  +                    }
  +                    final File src = new File( fromFile );
  +                    final File dest = new File( toFile );
  +                    if( forceOverwrite )
  +                    {
  +                        FileUtil.forceDelete( dest );
  +                    }
  +                    FileUtils.newFileUtils().copyFile( src, dest, executionFilters );
  +                    if( preserveLastModified )
  +                    {
  +                        dest.setLastModified( src.lastModified() );
                       }
  -                    fileUtils.copyFile( fromFile, toFile, executionFilters,
  -                                        forceOverwrite, preserveLastModified );
                   }
                   catch( IOException ioe )
                   {
  @@ -398,9 +397,9 @@
               if( count > 0 )
               {
                   getLogger().info( "Copied " + count +
  -                     " empty director" +
  -                     ( count == 1 ? "y" : "ies" ) +
  -                     " to " + destDir.getAbsolutePath() );
  +                                  " empty director" +
  +                                  ( count == 1 ? "y" : "ies" ) +
  +                                  " to " + destDir.getAbsolutePath() );
               }
           }
       }
  
  
  
  1.7       +7 -9      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Expand.java
  
  Index: Expand.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Expand.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Expand.java	2001/12/17 10:10:49	1.6
  +++ Expand.java	2001/12/17 10:47:18	1.7
  @@ -17,12 +17,12 @@
   import java.util.Vector;
   import java.util.zip.ZipEntry;
   import java.util.zip.ZipInputStream;
  +import org.apache.avalon.excalibur.io.FileUtil;
   import org.apache.myrmidon.api.TaskException;
   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.PatternSet;
  -import org.apache.tools.ant.util.FileUtils;
   
   /**
    * Unzip a file.
  @@ -115,8 +115,6 @@
               throw new TaskException( "Dest must be a directory." );
           }
   
  -        FileUtils fileUtils = FileUtils.newFileUtils();
  -
           if( source != null )
           {
               if( source.isDirectory() )
  @@ -126,7 +124,7 @@
               }
               else
               {
  -                expandFile( fileUtils, source, dest );
  +                expandFile( source, dest );
               }
           }
           if( filesets.size() > 0 )
  @@ -141,7 +139,7 @@
                   for( int i = 0; i < files.length; ++i )
                   {
                       File file = new File( fromDir, files[ i ] );
  -                    expandFile( fileUtils, file, dest );
  +                    expandFile( file, dest );
                   }
               }
           }
  @@ -150,7 +148,7 @@
       /*
        * This method is to be overridden by extending unarchival tasks.
        */
  -    protected void expandFile( FileUtils fileUtils, File srcF, File dir )
  +    protected void expandFile( File srcF, File dir )
           throws TaskException
       {
           ZipInputStream zis = null;
  @@ -162,7 +160,7 @@
   
               while( ( ze = zis.getNextEntry() ) != null )
               {
  -                extractFile( fileUtils, srcF, dir, zis,
  +                extractFile( srcF, dir, zis,
                                ze.getName(),
                                new Date( ze.getTime() ),
                                ze.isDirectory() );
  @@ -189,7 +187,7 @@
           }
       }
   
  -    protected void extractFile( FileUtils fileUtils, File srcF, File dir,
  +    protected void extractFile( File srcF, File dir,
                                   InputStream compressedInputStream,
                                   String entryName,
                                   Date entryDate, boolean isDirectory )
  @@ -237,7 +235,7 @@
               }
           }
   
  -        File f = fileUtils.resolveFile( dir, entryName );
  +        File f = FileUtil.resolveFile( dir, entryName );
           try
           {
               if( !overwrite && f.exists()
  
  
  
  1.6       +3 -5      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java
  
  Index: FixCRLF.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FixCRLF.java	2001/12/16 04:12:39	1.5
  +++ FixCRLF.java	2001/12/17 10:47:18	1.6
  @@ -66,7 +66,7 @@
    *
    * @author Sam Ruby <a href="mailto:rubys@us.ibm.com">rubys@us.ibm.com</a>
    * @author <a href="mailto:pbwest@powerup.com.au">Peter B. West</a>
  - * @version $Revision: 1.5 $ $Name:  $
  + * @version $Revision: 1.6 $ $Name:  $
    */
   
   public class FixCRLF extends MatchingTask
  @@ -101,8 +101,6 @@
       private boolean javafiles = false;
       private File destDir = null;
   
  -    private FileUtils fileUtils = FileUtils.newFileUtils();
  -
       /**
        * Encoding to assume for the files
        */
  @@ -578,7 +576,7 @@
               // Set up the output Writer
               try
               {
  -                tmpFile = fileUtils.createTempFile( "fixcrlf", "", destD );
  +                tmpFile = File.createTempFile( "fixcrlf", "", destD );
                   Writer writer = ( encoding == null ) ? new FileWriter( tmpFile )
                       : new OutputStreamWriter( new FileOutputStream( tmpFile ), encoding );
                   outWriter = new BufferedWriter( writer );
  @@ -761,7 +759,7 @@
               {
                   // Compare the destination with the temp file
                   log( "destFile exists", Project.MSG_DEBUG );
  -                if( !fileUtils.contentEquals( destFile, tmpFile ) )
  +                if( !FileUtils.newFileUtils().contentEquals( destFile, tmpFile ) )
                   {
                       log( destFile + " is being written", Project.MSG_DEBUG );
                       if( !destFile.delete() )
  
  
  
  1.8       +3 -5      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
  
  Index: Javadoc.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javadoc.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Javadoc.java	2001/12/17 09:50:11	1.7
  +++ Javadoc.java	2001/12/17 10:47:18	1.8
  @@ -21,8 +21,8 @@
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.Task;
   import org.apache.tools.ant.taskdefs.exec.Execute;
  -import org.apache.tools.ant.taskdefs.exec.PumpStreamHandler;
   import org.apache.tools.ant.taskdefs.exec.LogOutputStream;
  +import org.apache.tools.ant.taskdefs.exec.PumpStreamHandler;
   import org.apache.tools.ant.types.Commandline;
   import org.apache.tools.ant.types.EnumeratedAttribute;
   import org.apache.tools.ant.types.FileSet;
  @@ -95,8 +95,6 @@
       private boolean useExternalFile = false;
       private File tmpList = null;
   
  -    private FileUtils fileUtils = FileUtils.newFileUtils();
  -
       public void setAccess( AccessType at )
       {
           cmd.createArgument().setValue( "-" + at.getValue() );
  @@ -873,7 +871,7 @@
                   {
                       if( tmpList == null )
                       {
  -                        tmpList = fileUtils.createTempFile( "javadoc", "", null );
  +                        tmpList = File.createTempFile( "javadoc", "", getBaseDirectory() );
                           toExecute.createArgument().setValue( "@" + tmpList.getAbsolutePath() );
                       }
                       srcListWriter = new PrintWriter( new FileWriter( tmpList.getAbsolutePath(),
  @@ -1122,7 +1120,7 @@
           {
               if( useExternalFile )
               {
  -                tmpList = fileUtils.createTempFile( "javadoc", "", null );
  +                tmpList = File.createTempFile( "javadoc", "", getBaseDirectory() );
                   toExecute.createArgument().setValue( "@" + tmpList.getAbsolutePath() );
                   packageListWriter = new PrintWriter( new FileWriter( tmpList ) );
               }
  
  
  
  1.6       +9 -3      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Move.java
  
  Index: Move.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Move.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Move.java	2001/12/16 05:44:55	1.5
  +++ Move.java	2001/12/17 10:47:18	1.6
  @@ -10,8 +10,10 @@
   import java.io.File;
   import java.io.IOException;
   import java.util.Enumeration;
  +import org.apache.avalon.excalibur.io.FileUtil;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.tools.ant.Project;
  +import org.apache.tools.ant.util.FileUtils;
   import org.apache.tools.ant.types.FileSet;
   import org.apache.tools.ant.types.FilterSet;
   import org.apache.tools.ant.types.FilterSetCollection;
  @@ -106,7 +108,7 @@
           if( fileCopyMap.size() > 0 )
           {// files to move
               getLogger().info( "Moving " + fileCopyMap.size() + " files to " +
  -                 destDir.getAbsolutePath() );
  +                              destDir.getAbsolutePath() );
   
               Enumeration e = fileCopyMap.keys();
               while( e.hasMoreElements() )
  @@ -156,8 +158,12 @@
                               {
                                   executionFilters.addFilterSet( (FilterSet)filterEnum.nextElement() );
                               }
  -                            getFileUtils().copyFile( f, d, executionFilters,
  -                                                     forceOverwrite );
  +
  +                            if( forceOverwrite )
  +                            {
  +                                FileUtil.forceDelete( d );
  +                            }
  +                            FileUtils.newFileUtils().copyFile( f, d, executionFilters );
   
                               f = new File( fromFile );
                               if( !f.delete() )
  
  
  
  1.5       +9 -4      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Replace.java
  
  Index: Replace.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Replace.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Replace.java	2001/12/17 10:10:49	1.4
  +++ Replace.java	2001/12/17 10:47:18	1.5
  @@ -55,8 +55,6 @@
        */
       private String encoding = null;
   
  -    private FileUtils fileUtils = FileUtils.newFileUtils();
  -
       private int fileCount;
       private int replaceCount;
   
  @@ -295,8 +293,15 @@
               throw new TaskException( "Replace: source file " + src.getPath() + " doesn't exist" );
           }
   
  -        File temp = fileUtils.createTempFile( "rep", ".tmp",
  -                                              src.getParentFile() );
  +        File temp = null;
  +        try
  +        {
  +            temp = File.createTempFile( "rep", ".tmp", src.getParentFile() );
  +        }
  +        catch( IOException ioe )
  +        {
  +            throw new TaskException( ioe.toString(), ioe );
  +        }
   
           Reader reader = null;
           Writer writer = null;
  
  
  
  1.10      +2 -1      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Rmic.java
  
  Index: Rmic.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Rmic.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Rmic.java	2001/12/16 05:01:12	1.9
  +++ Rmic.java	2001/12/17 10:47:18	1.10
  @@ -11,6 +11,7 @@
   import java.io.IOException;
   import java.rmi.Remote;
   import java.util.Vector;
  +import org.apache.avalon.excalibur.io.FileUtil;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.tools.ant.AntClassLoader;
   import org.apache.tools.ant.DirectoryScanner;
  @@ -688,7 +689,7 @@
                   }
                   else
                   {
  -                    FileUtils.newFileUtils().copyFile( oldFile, newFile );
  +                    FileUtil.copyFile( oldFile, newFile );
                   }
                   oldFile.delete();
               }
  
  
  
  1.5       +0 -7      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Touch.java
  
  Index: Touch.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Touch.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Touch.java	2001/12/17 09:57:28	1.4
  +++ Touch.java	2001/12/17 10:47:18	1.5
  @@ -19,7 +19,6 @@
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.Task;
   import org.apache.tools.ant.types.FileSet;
  -import org.apache.tools.ant.util.FileUtils;
   
   /**
    * Touch a file and/or fileset(s) -- corresponds to the Unix touch command. <p>
  @@ -39,12 +38,6 @@
       private String dateTime;
   
       private File file;
  -    private FileUtils fileUtils;
  -
  -    public Touch()
  -    {
  -        fileUtils = FileUtils.newFileUtils();
  -    }
   
       /**
        * Date in the format MM/DD/YYYY HH:MM AM_PM.
  
  
  
  1.5       +2 -3      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Untar.java
  
  Index: Untar.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Untar.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Untar.java	2001/12/16 02:05:41	1.4
  +++ Untar.java	2001/12/17 10:47:18	1.5
  @@ -12,7 +12,6 @@
   import java.io.IOException;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.tools.ant.Project;
  -import org.apache.tools.ant.util.FileUtils;
   import org.apache.tools.tar.TarEntry;
   import org.apache.tools.tar.TarInputStream;
   
  @@ -25,7 +24,7 @@
   public class Untar extends Expand
   {
   
  -    protected void expandFile( FileUtils fileUtils, File srcF, File dir )
  +    protected void expandFile( File srcF, File dir )
           throws TaskException
       {
           TarInputStream tis = null;
  @@ -38,7 +37,7 @@
   
               while( ( te = tis.getNextEntry() ) != null )
               {
  -                extractFile( fileUtils, srcF, dir, tis,
  +                extractFile( srcF, dir, tis,
                                te.getName(),
                                te.getModTime(), te.isDirectory() );
               }
  
  
  
  1.7       +9 -4      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Zip.java
  
  Index: Zip.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Zip.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Zip.java	2001/12/17 10:10:49	1.6
  +++ Zip.java	2001/12/17 10:47:18	1.7
  @@ -28,7 +28,6 @@
   import org.apache.tools.ant.types.FileSet;
   import org.apache.tools.ant.types.ZipFileSet;
   import org.apache.tools.ant.types.ZipScanner;
  -import org.apache.tools.ant.util.FileUtils;
   import org.apache.tools.ant.util.MergingMapper;
   import org.apache.tools.ant.util.SourceFileScanner;
   import org.apache.tools.zip.ZipEntry;
  @@ -235,9 +234,15 @@
           doUpdate = doUpdate && zipFile.exists();
           if( doUpdate )
           {
  -            FileUtils fileUtils = FileUtils.newFileUtils();
  -            renamedFile = fileUtils.createTempFile( "zip", ".tmp",
  -                                                    zipFile.getParentFile() );
  +            try
  +            {
  +                renamedFile = File.createTempFile( "zip", ".tmp",
  +                                                   zipFile.getParentFile() );
  +            }
  +            catch( final IOException ioe )
  +            {
  +                throw new TaskException( ioe.toString(), ioe );
  +            }
   
               try
               {
  
  
  
  1.9       +2 -4      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
  
  Index: DefaultCompilerAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DefaultCompilerAdapter.java	2001/12/17 09:50:11	1.8
  +++ DefaultCompilerAdapter.java	2001/12/17 10:47:19	1.9
  @@ -13,12 +13,11 @@
   import java.io.PrintWriter;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.tools.ant.Project;
  -import org.apache.tools.ant.taskdefs.exec.Execute;
   import org.apache.tools.ant.taskdefs.Javac;
  +import org.apache.tools.ant.taskdefs.exec.Execute;
   import org.apache.tools.ant.taskdefs.exec.LogStreamHandler;
   import org.apache.tools.ant.types.Commandline;
   import org.apache.tools.ant.types.Path;
  -import org.apache.tools.ant.util.FileUtils;
   
   /**
    * This is the default implementation for the CompilerAdapter interface.
  @@ -39,7 +38,6 @@
       protected boolean depend = false;
       protected boolean verbose = false;
   
  -    private FileUtils fileUtils = FileUtils.newFileUtils();
       protected Javac attributes;
       protected Path bootclasspath;
       protected Path compileClasspath;
  @@ -400,7 +398,7 @@
                   PrintWriter out = null;
                   try
                   {
  -                    tmpFile = fileUtils.createTempFile( "jikes", "", null );
  +                    tmpFile = File.createTempFile( "jikes", "", new File( "." ) );
                       out = new PrintWriter( new FileWriter( tmpFile ) );
                       for( int i = firstFileName; i < args.length; i++ )
                       {
  
  
  
  1.2       +3 -3      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/Execute.java
  
  Index: Execute.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/Execute.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Execute.java	2001/12/17 09:49:30	1.1
  +++ Execute.java	2001/12/17 10:47:19	1.2
  @@ -16,12 +16,12 @@
   import java.lang.reflect.Method;
   import java.util.Locale;
   import java.util.Vector;
  +import org.apache.avalon.excalibur.io.FileUtil;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.framework.Os;
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.Task;
   import org.apache.tools.ant.types.Commandline;
  -import org.apache.tools.ant.util.FileUtils;
   
   /**
    * Runs an external program.
  @@ -817,7 +817,7 @@
               {
                   throw new IOException( "Cannot locate antRun script: Property 'ant.home' not found" );
               }
  -            String antRun = FileUtils.newFileUtils().
  +            String antRun = FileUtil.
                   resolveFile( project.getBaseDir(), antHome + File.separator + _script ).toString();
   
               // Build the command
  @@ -883,7 +883,7 @@
               {
                   throw new IOException( "Cannot locate antRun script: Property 'ant.home' not found" );
               }
  -            String antRun = FileUtils.newFileUtils().
  +            String antRun = FileUtil.
                   resolveFile( project.getBaseDir(), antHome + File.separator + _script ).toString();
   
               // Build the command
  
  
  
  1.9       +3 -6      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java
  
  Index: Cab.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Cab.java	2001/12/17 09:50:11	1.8
  +++ Cab.java	2001/12/17 10:47:19	1.9
  @@ -18,11 +18,9 @@
   import org.apache.myrmidon.framework.Os;
   import org.apache.tools.ant.DirectoryScanner;
   import org.apache.tools.ant.Project;
  -import org.apache.tools.ant.taskdefs.exec.ExecTask;
   import org.apache.tools.ant.taskdefs.MatchingTask;
  -import org.apache.tools.ant.types.Commandline;
  +import org.apache.tools.ant.taskdefs.exec.ExecTask;
   import org.apache.tools.ant.types.FileSet;
  -import org.apache.tools.ant.util.FileUtils;
   
   /**
    * Create a CAB archive.
  @@ -39,7 +37,6 @@
   
       protected String archiveType = "cab";
   
  -    private FileUtils fileUtils = FileUtils.newFileUtils();
       private File baseDir;
   
       private File cabFile;
  @@ -161,7 +158,7 @@
   
                   if( !doVerbose )
                   {
  -                    outFile = fileUtils.createTempFile( "ant", "", null );
  +                    outFile = File.createTempFile( "ant", "", getBaseDirectory() );
                       exec.setOutput( outFile );
                   }
   
  @@ -327,7 +324,7 @@
       protected File createListFile( Vector files )
           throws IOException
       {
  -        File listFile = fileUtils.createTempFile( "ant", "", null );
  +        File listFile = File.createTempFile( "ant", "", getBaseDirectory() );
   
           PrintWriter writer = new PrintWriter( new FileOutputStream( listFile ) );
   
  
  
  
  1.5       +6 -6      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
  
  Index: NetRexxC.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NetRexxC.java	2001/12/16 05:44:55	1.4
  +++ NetRexxC.java	2001/12/17 10:47:19	1.5
  @@ -17,11 +17,11 @@
   import java.util.StringTokenizer;
   import java.util.Vector;
   import netrexx.lang.Rexx;
  +import org.apache.avalon.excalibur.io.FileUtil;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.tools.ant.DirectoryScanner;
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.taskdefs.MatchingTask;
  -import org.apache.tools.ant.util.FileUtils;
   
   /**
    * Task to compile NetRexx source files. This task can take the following
  @@ -501,8 +501,8 @@
           if( compileList.size() > 0 )
           {
               getLogger().info( "Compiling " + compileList.size() + " source file"
  -                 + ( compileList.size() == 1 ? "" : "s" )
  -                 + " to " + destDir );
  +                              + ( compileList.size() == 1 ? "" : "s" )
  +                              + " to " + destDir );
               doNetRexxCompile();
           }
       }
  @@ -611,8 +611,8 @@
           if( filecopyList.size() > 0 )
           {
               getLogger().info( "Copying " + filecopyList.size() + " file"
  -                 + ( filecopyList.size() == 1 ? "" : "s" )
  -                 + " to " + destDir.getAbsolutePath() );
  +                              + ( filecopyList.size() == 1 ? "" : "s" )
  +                              + " to " + destDir.getAbsolutePath() );
               Enumeration enum = filecopyList.keys();
               while( enum.hasMoreElements() )
               {
  @@ -620,7 +620,7 @@
                   String toFile = (String)filecopyList.get( fromFile );
                   try
                   {
  -                    FileUtils.newFileUtils().copyFile( fromFile, toFile );
  +                    FileUtil.copyFile( new File( fromFile ), new File( toFile ) );
                   }
                   catch( IOException ioe )
                   {
  
  
  
  1.4       +1 -4      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java
  
  Index: ReplaceRegExp.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ReplaceRegExp.java	2001/12/16 01:31:38	1.3
  +++ ReplaceRegExp.java	2001/12/17 10:47:19	1.4
  @@ -23,7 +23,6 @@
   import org.apache.tools.ant.types.FileSet;
   import org.apache.tools.ant.types.RegularExpression;
   import org.apache.tools.ant.types.Substitution;
  -import org.apache.tools.ant.util.FileUtils;
   import org.apache.tools.ant.util.regexp.Regexp;
   
   /**
  @@ -73,8 +72,6 @@
    */
   public class ReplaceRegExp extends Task
   {
  -
  -    private FileUtils fileUtils = FileUtils.newFileUtils();
       private boolean byline;
   
       private File file;
  @@ -263,7 +260,7 @@
           throws IOException, TaskException
       {
           File parentDir = new File( new File( f.getAbsolutePath() ).getParent() );
  -        File temp = fileUtils.createTempFile( "replace", ".txt", parentDir );
  +        File temp = File.createTempFile( "replace", ".txt", parentDir );
   
           FileReader r = null;
           FileWriter w = null;
  
  
  
  1.6       +2 -2      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java
  
  Index: WeblogicDeploymentTool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- WeblogicDeploymentTool.java	2001/12/16 04:12:39	1.5
  +++ WeblogicDeploymentTool.java	2001/12/17 10:47:19	1.6
  @@ -20,12 +20,12 @@
   import java.util.jar.JarOutputStream;
   import javax.xml.parsers.SAXParser;
   import javax.xml.parsers.SAXParserFactory;
  +import org.apache.avalon.excalibur.io.FileUtil;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.tools.ant.AntClassLoader;
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.taskdefs.Java;
   import org.apache.tools.ant.types.Path;
  -import org.apache.tools.ant.util.FileUtils;
   import org.xml.sax.InputSource;
   
   public class WeblogicDeploymentTool extends GenericDeploymentTool
  @@ -755,7 +755,7 @@
           {
               try
               {
  -                FileUtils.newFileUtils().copyFile( sourceJar, destJar );
  +                FileUtil.copyFile( sourceJar, destJar );
                   if( !keepgenerated )
                   {
                       sourceJar.delete();
  
  
  
  1.4       +2 -6      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java
  
  Index: Translate.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Translate.java	2001/12/16 00:36:49	1.3
  +++ Translate.java	2001/12/17 10:47:19	1.4
  @@ -18,12 +18,12 @@
   import java.util.Hashtable;
   import java.util.Locale;
   import java.util.Vector;
  +import org.apache.avalon.excalibur.io.FileUtil;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.tools.ant.DirectoryScanner;
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.taskdefs.MatchingTask;
   import org.apache.tools.ant.types.FileSet;
  -import org.apache.tools.ant.util.FileUtils;
   
   /**
    * Translates text embedded in files using Resource Bundle files.
  @@ -41,10 +41,6 @@
        */
       private Hashtable resourceMap = new Hashtable();
       /**
  -     * Used to resolve file names.
  -     */
  -    private FileUtils fileUtils = FileUtils.newFileUtils();
  -    /**
        * Last Modified Timestamp of resource bundle file being used.
        */
       private long[] bundleLastModified = new long[ 7 ];
  @@ -528,7 +524,7 @@
               {
                   try
                   {
  -                    File dest = fileUtils.resolveFile( toDir, srcFiles[ j ] );
  +                    File dest = FileUtil.resolveFile( toDir, srcFiles[ j ] );
                       //Make sure parent dirs exist, else, create them.
                       try
                       {
  
  
  
  1.6       +3 -4      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java
  
  Index: AggregateTransformer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AggregateTransformer.java	2001/12/16 06:21:41	1.5
  +++ AggregateTransformer.java	2001/12/17 10:47:19	1.6
  @@ -15,11 +15,11 @@
   import java.net.URL;
   import javax.xml.parsers.DocumentBuilder;
   import javax.xml.parsers.DocumentBuilderFactory;
  +import org.apache.avalon.excalibur.io.FileUtil;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.Task;
   import org.apache.tools.ant.types.EnumeratedAttribute;
  -import org.apache.tools.ant.util.FileUtils;
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
   
  @@ -215,12 +215,11 @@
           // set the destination directory relative from the project if needed.
           if( toDir == null )
           {
  -            toDir = FileUtils.newFileUtils().resolveFile( task.getBaseDirectory(), "." );
  +            toDir = FileUtil.resolveFile( task.getBaseDirectory(), "." );
           }
           else if( !toDir.isAbsolute() )
           {
  -            toDir = FileUtils.newFileUtils().
  -                resolveFile( task.getBaseDirectory(), toDir.getPath() );
  +            toDir = FileUtil.resolveFile( task.getBaseDirectory(), toDir.getPath() );
           }
       }
   
  
  
  
  1.4       +3 -3      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java
  
  Index: XMLResultAggregator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XMLResultAggregator.java	2001/12/16 00:36:00	1.3
  +++ XMLResultAggregator.java	2001/12/17 10:47:19	1.4
  @@ -17,13 +17,13 @@
   import java.util.Vector;
   import javax.xml.parsers.DocumentBuilder;
   import javax.xml.parsers.DocumentBuilderFactory;
  +import org.apache.avalon.excalibur.io.FileUtil;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.tools.ant.DirectoryScanner;
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.Task;
   import org.apache.tools.ant.types.FileSet;
   import org.apache.tools.ant.util.DOMElementWriter;
  -import org.apache.tools.ant.util.FileUtils;
   import org.apache.tools.ant.util.StringUtils;
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
  @@ -184,7 +184,7 @@
           }
           if( toDir == null )
           {
  -            toDir = FileUtils.newFileUtils().resolveFile( project.getBaseDir(), DEFAULT_DIR );
  +            toDir = FileUtil.resolveFile( project.getBaseDir(), DEFAULT_DIR );
           }
           return new File( toDir, toFile );
       }
  @@ -210,7 +210,7 @@
                   if( pathname.endsWith( ".xml" ) )
                   {
                       File file = new File( ds.getBasedir(), pathname );
  -                    file = FileUtils.newFileUtils().
  +                    file = FileUtil.
                           resolveFile( project.getBaseDir(), file.getPath() );
                       v.addElement( file );
                   }
  
  
  
  1.4       +2 -3      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/types/Path.java
  
  Index: Path.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/types/Path.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Path.java	2001/12/16 00:38:47	1.3
  +++ Path.java	2001/12/17 10:47:19	1.4
  @@ -12,11 +12,11 @@
   import java.util.Locale;
   import java.util.Stack;
   import java.util.Vector;
  +import org.apache.avalon.excalibur.io.FileUtil;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.tools.ant.DirectoryScanner;
   import org.apache.tools.ant.PathTokenizer;
   import org.apache.tools.ant.Project;
  -import org.apache.tools.ant.util.FileUtils;
   
   /**
    * This object represents a path as used by CLASSPATH or PATH environment
  @@ -196,8 +196,7 @@
       {
           if( project != null )
           {
  -            File f = FileUtils.newFileUtils().
  -                resolveFile( project.getBaseDir(), relativeName );
  +            File f = FileUtil.resolveFile( project.getBaseDir(), relativeName );
               return f.getAbsolutePath();
           }
           return relativeName;
  
  
  
  1.6       +5 -242    jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/util/FileUtils.java
  
  Index: FileUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/util/FileUtils.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FileUtils.java	2001/12/17 10:10:49	1.5
  +++ FileUtils.java	2001/12/17 10:47:20	1.6
  @@ -17,8 +17,6 @@
   import java.io.FileWriter;
   import java.io.IOException;
   import java.io.InputStream;
  -import java.text.DecimalFormat;
  -import java.util.Random;
   import java.util.Stack;
   import java.util.StringTokenizer;
   import org.apache.myrmidon.api.TaskException;
  @@ -32,21 +30,12 @@
    * @author duncan@x180.com
    * @author <a href="mailto:conor@apache.org">Conor MacNeill</a>
    * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
  - * @version $Revision: 1.5 $
  + * @version $Revision: 1.6 $
    */
   
   public class FileUtils
   {
  -    private static Random rand = new Random( System.currentTimeMillis() );
  -
       /**
  -     * Empty constructor.
  -     */
  -    private FileUtils()
  -    {
  -    }
  -
  -    /**
        * Factory method.
        *
        * @return Description of the Returned Value
  @@ -133,54 +122,6 @@
       }
   
       /**
  -     * Convienence method to copy a file from a source to a destination. No
  -     * filtering is performed.
  -     *
  -     * @param sourceFile Description of Parameter
  -     * @param destFile Description of Parameter
  -     * @throws IOException
  -     */
  -    public void copyFile( String sourceFile, String destFile )
  -        throws IOException, TaskException
  -    {
  -        copyFile( new File( sourceFile ), new File( destFile ), null, false, false );
  -    }
  -
  -    /**
  -     * Convienence method to copy a file from a source to a destination
  -     * specifying if token filtering must be used.
  -     *
  -     * @param sourceFile Description of Parameter
  -     * @param destFile Description of Parameter
  -     * @param filters Description of Parameter
  -     * @throws IOException
  -     */
  -    public void copyFile( String sourceFile, String destFile, FilterSetCollection filters )
  -        throws IOException, TaskException
  -    {
  -        copyFile( new File( sourceFile ), new File( destFile ), filters, false, false );
  -    }
  -
  -    /**
  -     * Convienence method to copy a file from a source to a destination
  -     * specifying if token filtering must be used and if source files may
  -     * overwrite newer destination files.
  -     *
  -     * @param sourceFile Description of Parameter
  -     * @param destFile Description of Parameter
  -     * @param filters Description of Parameter
  -     * @param overwrite Description of Parameter
  -     * @throws IOException
  -     */
  -    public void copyFile( String sourceFile, String destFile, FilterSetCollection filters,
  -                          boolean overwrite )
  -        throws IOException, TaskException
  -    {
  -        copyFile( new File( sourceFile ), new File( destFile ), filters,
  -                  overwrite, false );
  -    }
  -
  -    /**
        * Convienence method to copy a file from a source to a destination
        * specifying if token filtering must be used, if source files may overwrite
        * newer destination files and the last modified time of <code>destFile</code>
  @@ -193,85 +134,15 @@
        * @param overwrite Description of Parameter
        * @param preserveLastModified Description of Parameter
        * @throws IOException
  -     */
  -    public void copyFile( String sourceFile, String destFile, FilterSetCollection filters,
  -                          boolean overwrite, boolean preserveLastModified )
  -        throws IOException, TaskException
  -    {
  -        copyFile( new File( sourceFile ), new File( destFile ), filters,
  -                  overwrite, preserveLastModified );
  -    }
  -
  -    /**
  -     * Convienence method to copy a file from a source to a destination. No
  -     * filtering is performed.
  -     *
  -     * @param sourceFile Description of Parameter
  -     * @param destFile Description of Parameter
  -     * @throws IOException
  -     */
  -    public void copyFile( File sourceFile, File destFile )
  -        throws IOException, TaskException
  -    {
  -        copyFile( sourceFile, destFile, null, false, false );
  -    }
  -
  -    /**
  -     * Convienence method to copy a file from a source to a destination
  -     * specifying if token filtering must be used.
  -     *
  -     * @param sourceFile Description of Parameter
  -     * @param destFile Description of Parameter
  -     * @param filters Description of Parameter
  -     * @throws IOException
        */
  -    public void copyFile( File sourceFile, File destFile, FilterSetCollection filters )
  +    public void copyFile( File sourceFile,
  +                          File destFile,
  +                          FilterSetCollection filters )
           throws IOException, TaskException
       {
  -        copyFile( sourceFile, destFile, filters, false, false );
  -    }
  -
  -    /**
  -     * Convienence method to copy a file from a source to a destination
  -     * specifying if token filtering must be used and if source files may
  -     * overwrite newer destination files.
  -     *
  -     * @param sourceFile Description of Parameter
  -     * @param destFile Description of Parameter
  -     * @param filters Description of Parameter
  -     * @param overwrite Description of Parameter
  -     * @throws IOException
  -     */
  -    public void copyFile( File sourceFile, File destFile, FilterSetCollection filters,
  -                          boolean overwrite )
  -        throws IOException, TaskException
  -    {
  -        copyFile( sourceFile, destFile, filters, overwrite, false );
  -    }
  -
  -    /**
  -     * Convienence method to copy a file from a source to a destination
  -     * specifying if token filtering must be used, if source files may overwrite
  -     * newer destination files and the last modified time of <code>destFile</code>
  -     * file should be made equal to the last modified time of <code>sourceFile</code>
  -     * .
  -     *
  -     * @param sourceFile Description of Parameter
  -     * @param destFile Description of Parameter
  -     * @param filters Description of Parameter
  -     * @param overwrite Description of Parameter
  -     * @param preserveLastModified Description of Parameter
  -     * @throws IOException
  -     */
  -    public void copyFile( File sourceFile, File destFile, FilterSetCollection filters,
  -                          boolean overwrite, boolean preserveLastModified )
  -        throws IOException, TaskException
  -    {
  -
  -        if( overwrite || !destFile.exists() ||
  +        if( !destFile.exists() ||
               destFile.lastModified() < sourceFile.lastModified() )
           {
  -
               if( destFile.exists() && destFile.isFile() )
               {
                   destFile.delete();
  @@ -327,55 +198,10 @@
                   in.close();
                   out.close();
               }
  -
  -            if( preserveLastModified )
  -            {
  -                destFile.setLastModified( sourceFile.lastModified() );
  -            }
           }
       }
   
       /**
  -     * Create a temporary file in a given directory. <p>
  -     *
  -     * The file denoted by the returned abstract pathname did not exist before
  -     * this method was invoked, any subsequent invocation of this method will
  -     * yield a different file name.</p> <p>
  -     *
  -     * This method is different to File.createTempFile of JDK 1.2 as it doesn't
  -     * create the file itself and doesn't use platform specific temporary
  -     * directory when the parentDir attribute is null.</p>
  -     *
  -     * @param parentDir Directory to create the temporary file in - current
  -     *      working directory will be assumed if this parameter is null.
  -     * @param prefix Description of Parameter
  -     * @param suffix Description of Parameter
  -     * @return Description of the Returned Value
  -     * @since 1.8
  -     */
  -    public File createTempFile( String prefix, String suffix, File parentDir )
  -    {
  -
  -        File result = null;
  -        String parent = null;
  -        if( parentDir != null )
  -        {
  -            parent = parentDir.getPath();
  -        }
  -        DecimalFormat fmt = new DecimalFormat( "#####" );
  -        synchronized( rand )
  -        {
  -            do
  -            {
  -                result = new File( parent,
  -                                   prefix + fmt.format( rand.nextInt() )
  -                                   + suffix );
  -            } while( result.exists() );
  -        }
  -        return result;
  -    }
  -
  -    /**
        * &quot;normalize&quot; the given absolute path. <p>
        *
        * This includes:
  @@ -513,69 +339,6 @@
               path = path.replace( '/', '\\' );
           }
           return new File( path );
  -    }
  -
  -    /**
  -     * Interpret the filename as a file relative to the given file - unless the
  -     * filename already represents an absolute filename.
  -     *
  -     * @param file the "reference" file for relative paths. This instance must
  -     *      be an absolute file and must not contain &quot;./&quot; or
  -     *      &quot;../&quot; sequences (same for \ instead of /). If it is null,
  -     *      this call is equivalent to <code>new java.io.File(filename)</code>.
  -     * @param filename a file name
  -     * @return an absolute file that doesn't contain &quot;./&quot; or
  -     *      &quot;../&quot; sequences and uses the correct separator for the
  -     *      current platform.
  -     */
  -    public File resolveFile( File file, String filename )
  -        throws TaskException
  -    {
  -        filename = filename.replace( '/', File.separatorChar )
  -            .replace( '\\', File.separatorChar );
  -
  -        // deal with absolute files
  -        if( filename.startsWith( File.separator ) ||
  -            ( filename.length() >= 2 &&
  -            Character.isLetter( filename.charAt( 0 ) ) &&
  -            filename.charAt( 1 ) == ':' )
  -        )
  -        {
  -            return normalize( filename );
  -        }
  -
  -        if( file == null )
  -        {
  -            return new File( filename );
  -        }
  -
  -        File helpFile = new File( file.getAbsolutePath() );
  -        StringTokenizer tok = new StringTokenizer( filename, File.separator );
  -        while( tok.hasMoreTokens() )
  -        {
  -            String part = tok.nextToken();
  -            if( part.equals( ".." ) )
  -            {
  -                helpFile = helpFile.getParentFile();
  -                if( helpFile == null )
  -                {
  -                    String msg = "The file or path you specified ("
  -                        + filename + ") is invalid relative to "
  -                        + file.getPath();
  -                    throw new TaskException( msg );
  -                }
  -            }
  -            else if( part.equals( "." ) )
  -            {
  -                // Do nothing here
  -            }
  -            else
  -            {
  -                helpFile = new File( helpFile, part );
  -            }
  -        }
  -
  -        return new File( helpFile.getAbsolutePath() );
       }
   }
   
  
  
  
  1.4       +10 -13    jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/util/SourceFileScanner.java
  
  Index: SourceFileScanner.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/util/SourceFileScanner.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SourceFileScanner.java	2001/12/16 01:01:20	1.3
  +++ SourceFileScanner.java	2001/12/17 10:47:20	1.4
  @@ -13,6 +13,7 @@
   import org.apache.myrmidon.framework.Os;
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.Task;
  +import org.apache.avalon.excalibur.io.FileUtil;
   
   /**
    * Utility class that collects the functionality of the various scanDir methods
  @@ -26,18 +27,14 @@
    */
   public class SourceFileScanner
   {
  +    private Task m_task;
   
  -    protected Task task;
  -
  -    private FileUtils fileUtils;
  -
       /**
        * @param task The task we should log messages through
        */
       public SourceFileScanner( Task task )
       {
  -        this.task = task;
  -        fileUtils = FileUtils.newFileUtils();
  +        this.m_task = task;
       }
   
       /**
  @@ -80,16 +77,16 @@
               String[] targets = mapper.mapFileName( files[ i ] );
               if( targets == null || targets.length == 0 )
               {
  -                task.log( files[ i ] + " skipped - don\'t know how to handle it",
  +                m_task.log( files[ i ] + " skipped - don\'t know how to handle it",
                             Project.MSG_VERBOSE );
                   continue;
               }
   
  -            File src = fileUtils.resolveFile( srcDir, files[ i ] );
  +            File src = FileUtil.resolveFile( srcDir, files[ i ] );
   
               if( src.lastModified() > now )
               {
  -                task.log( "Warning: " + files[ i ] + " modified in the future.",
  +                m_task.log( "Warning: " + files[ i ] + " modified in the future.",
                             Project.MSG_WARN );
               }
   
  @@ -97,18 +94,18 @@
               targetList.setLength( 0 );
               for( int j = 0; !added && j < targets.length; j++ )
               {
  -                File dest = fileUtils.resolveFile( destDir, targets[ j ] );
  +                File dest = FileUtil.resolveFile( destDir, targets[ j ] );
   
                   if( !dest.exists() )
                   {
  -                    task.log( files[ i ] + " added as " + dest.getAbsolutePath() + " doesn\'t exist.",
  +                    m_task.log( files[ i ] + " added as " + dest.getAbsolutePath() + " doesn\'t exist.",
                                 Project.MSG_VERBOSE );
                       v.addElement( files[ i ] );
                       added = true;
                   }
                   else if( src.lastModified() > dest.lastModified() )
                   {
  -                    task.log( files[ i ] + " added as " + dest.getAbsolutePath() + " is outdated.",
  +                    m_task.log( files[ i ] + " added as " + dest.getAbsolutePath() + " is outdated.",
                                 Project.MSG_VERBOSE );
                       v.addElement( files[ i ] );
                       added = true;
  @@ -125,7 +122,7 @@
   
               if( !added )
               {
  -                task.log( files[ i ] + " omitted as " + targetList.toString()
  +                m_task.log( files[ i ] + " omitted as " + targetList.toString()
                             + ( targets.length == 1 ? " is" : " are " )
                             + " up to date.", Project.MSG_VERBOSE );
               }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>