ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/util FileUtils.java
Date Sun, 10 Feb 2002 01:10:41 GMT
donaldp     02/02/09 17:10:41

  Modified:    proposal/myrmidon/src/main/org/apache/tools/ant/types
                        FilterSetCollection.java FilterSet.java
               proposal/myrmidon/src/main/org/apache/tools/ant/util
                        FileUtils.java
  Log:
  Remove some unused cruft
  
  Revision  Changes    Path
  1.6       +7 -38     jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSetCollection.java
  
  Index: FilterSetCollection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSetCollection.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FilterSetCollection.java	23 Dec 2001 06:32:48 -0000	1.5
  +++ FilterSetCollection.java	10 Feb 2002 01:10:41 -0000	1.6
  @@ -7,14 +7,10 @@
    */
   package org.apache.tools.ant.types;// java io classes
   
  -// java util classes
  -
   import java.util.ArrayList;
   import java.util.Iterator;
   import org.apache.myrmidon.api.TaskException;
   
  -// ant classes
  -
   /**
    * A FilterSetCollection is a collection of filtersets each of which may have a
    * different start/end token settings.
  @@ -23,40 +19,11 @@
    */
   public class FilterSetCollection
   {
  +    private ArrayList m_filterSets = new ArrayList();
   
  -    private ArrayList filterSets = new ArrayList();
  -
  -    public FilterSetCollection()
  -    {
  -    }
  -
  -    public FilterSetCollection( FilterSet filterSet )
  -    {
  -        addFilterSet( filterSet );
  -    }
  -
  -    public void addFilterSet( FilterSet filterSet )
  +    public void addFilterSet( final FilterSet filterSet )
       {
  -        filterSets.add( filterSet );
  -    }
  -
  -    /**
  -     * Test to see if this filter set it empty.
  -     *
  -     * @return Return true if there are filter in this set otherwise false.
  -     */
  -    public boolean hasFilters()
  -        throws TaskException
  -    {
  -        for( Iterator e = filterSets.iterator(); e.hasNext(); )
  -        {
  -            FilterSet filterSet = (FilterSet)e.next();
  -            if( filterSet.hasFilters() )
  -            {
  -                return true;
  -            }
  -        }
  -        return false;
  +        m_filterSets.add( filterSet );
       }
   
       /**
  @@ -70,9 +37,11 @@
           throws TaskException
       {
           String replacedLine = line;
  -        for( Iterator e = filterSets.iterator(); e.hasNext(); )
  +
  +        final Iterator filterSets = m_filterSets.iterator();
  +        while( filterSets.hasNext() )
           {
  -            FilterSet filterSet = (FilterSet)e.next();
  +            final FilterSet filterSet = (FilterSet)filterSets.next();
               replacedLine = filterSet.replaceTokens( replacedLine );
           }
           return replacedLine;
  
  
  
  1.12      +2 -13     jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSet.java
  
  Index: FilterSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSet.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- FilterSet.java	10 Feb 2002 00:18:08 -0000	1.11
  +++ FilterSet.java	10 Feb 2002 01:10:41 -0000	1.12
  @@ -5,7 +5,7 @@
    * version 1.1, a copy of which has been included with this distribution in
    * the LICENSE.txt file.
    */
  -package org.apache.tools.ant.types;// java io classes
  +package org.apache.tools.ant.types;
   
   import java.io.File;
   import java.io.FileInputStream;
  @@ -81,7 +81,7 @@
        *
        * @param filter The feature to be added to the Filter attribute
        */
  -    public void addFilter( Filter filter )
  +    public void addFilter( final Filter filter )
       {
           m_filters.add( filter );
       }
  @@ -120,17 +120,6 @@
       {
           return new FiltersFile();
       }*/
  -
  -    /**
  -     * Test to see if this filter set it empty.
  -     *
  -     * @return Return true if there are filter in this set otherwise false.
  -     */
  -    public boolean hasFilters()
  -        throws TaskException
  -    {
  -        return m_filters.size() > 0;
  -    }
   
       /**
        * Read the filters from the given file.
  
  
  
  1.21      +1 -65     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.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- FileUtils.java	9 Feb 2002 23:34:16 -0000	1.20
  +++ FileUtils.java	10 Feb 2002 01:10:41 -0000	1.21
  @@ -32,7 +32,7 @@
    * @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.20 $
  + * @version $Revision: 1.21 $
    */
   public class FileUtils
   {
  @@ -50,70 +50,6 @@
           }
   
           return (String[])result.toArray( new String[ result.size() ] );
  -    }
  -
  -    /**
  -     * 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>
  -     * .
  -     */
  -    public static void copyFile( final File sourceFile,
  -                                 final File destFile,
  -                                 final FilterSetCollection filters )
  -        throws IOException, TaskException
  -    {
  -        if( !destFile.exists() ||
  -            destFile.lastModified() < sourceFile.lastModified() )
  -        {
  -            if( destFile.exists() && destFile.isFile() )
  -            {
  -                destFile.delete();
  -            }
  -
  -            // ensure that parent dir of dest file exists!
  -            // not using getParentFile method to stay 1.1 compat
  -            File parent = destFile.getParentFile();
  -            if( !parent.exists() )
  -            {
  -                parent.mkdirs();
  -            }
  -
  -            if( filters != null && filters.hasFilters() )
  -            {
  -                BufferedReader in = new BufferedReader( new FileReader( sourceFile ) );
  -                BufferedWriter out = new BufferedWriter( new FileWriter( destFile ) );
  -
  -                String newline = null;
  -                String line = in.readLine();
  -                while( line != null )
  -                {
  -                    if( line.length() == 0 )
  -                    {
  -                        out.newLine();
  -                    }
  -                    else
  -                    {
  -                        newline = filters.replaceTokens( line );
  -                        out.write( newline );
  -                        out.newLine();
  -                    }
  -                    line = in.readLine();
  -                }
  -
  -                IOUtil.shutdownReader( in );
  -                IOUtil.shutdownWriter( out );
  -            }
  -            else
  -            {
  -                final FileInputStream in = new FileInputStream( sourceFile );
  -                final FileOutputStream out = new FileOutputStream( destFile );
  -                IOUtil.copy( in, out );
  -                IOUtil.shutdownStream( in );
  -                IOUtil.shutdownStream( out );
  -            }
  -        }
       }
   
       /**
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message