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/types SourceFileScanner.java
Date Fri, 25 Jan 2002 23:59:59 GMT
donaldp     02/01/25 15:59:59

  Modified:    proposal/myrmidon/src/main/org/apache/tools/ant/types
                        SourceFileScanner.java
  Log:
  Cleaned up scanner a little
  
  Revision  Changes    Path
  1.4       +22 -21    jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/types/SourceFileScanner.java
  
  Index: SourceFileScanner.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/types/SourceFileScanner.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SourceFileScanner.java	20 Jan 2002 02:36:21 -0000	1.3
  +++ SourceFileScanner.java	25 Jan 2002 23:59:59 -0000	1.4
  @@ -9,6 +9,7 @@
   
   import java.io.File;
   import java.util.ArrayList;
  +import java.util.Date;
   import org.apache.aut.nativelib.Os;
   import org.apache.avalon.excalibur.io.FileUtil;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
  @@ -38,14 +39,13 @@
        *      mapper are assumed to be absolute.
        * @param mapper knows how to construct a target file names from source file
        *      names.
  -     * @return Description of the Returned Value
        */
       public String[] restrict( String[] files, File srcDir, File destDir,
                                 FileNameMapper mapper )
           throws TaskException
       {
   
  -        long now = ( new java.util.Date() ).getTime();
  +        long now = ( new Date() ).getTime();
           StringBuffer targetList = new StringBuffer();
   
           /*
  @@ -61,19 +61,18 @@
               now += 2000;
           }
   
  -        ArrayList v = new ArrayList();
  +        final ArrayList v = new ArrayList();
           for( int i = 0; i < files.length; i++ )
           {
  -
  -            String[] targets = mapper.mapFileName( files[ i ] );
  +            final String[] targets = mapper.mapFileName( files[ i ] );
               if( targets == null || targets.length == 0 )
               {
  -                getLogger().debug( files[ i ] + " skipped - don\'t know how to handle it"
);
  +                final String message = files[ i ] + " skipped - don\'t know how to handle
it";
  +                getLogger().debug( message );
                   continue;
               }
   
  -            File src = FileUtil.resolveFile( srcDir, files[ i ] );
  -
  +            final File src = FileUtil.resolveFile( srcDir, files[ i ] );
               if( src.lastModified() > now )
               {
                   final String message = "Warning: " + files[ i ] + " modified in the future.";
  @@ -88,13 +87,17 @@
   
                   if( !dest.exists() )
                   {
  -                    getLogger().debug( files[ i ] + " added as " + dest.getAbsolutePath()
+ " doesn\'t exist." );
  +                    final String message =
  +                        files[ i ] + " added as " + dest.getAbsolutePath() + " doesn\'t
exist.";
  +                    getLogger().debug( message );
                       v.add( files[ i ] );
                       added = true;
                   }
                   else if( src.lastModified() > dest.lastModified() )
                   {
  -                    getLogger().debug( files[ i ] + " added as " + dest.getAbsolutePath()
+ " is outdated." );
  +                    final String message =
  +                        files[ i ] + " added as " + dest.getAbsolutePath() + " is outdated.";
  +                    getLogger().debug( message );
                       v.add( files[ i ] );
                       added = true;
                   }
  @@ -110,7 +113,9 @@
   
               if( !added )
               {
  -                getLogger().debug( files[ i ] + " omitted as " + targetList.toString()
+ ( targets.length == 1 ? " is" : " are " ) + " up to date." );
  +                final String message = files[ i ] + " omitted as " + targetList.toString()
+
  +                    ( targets.length == 1 ? " is" : " are " ) + " up to date.";
  +                getLogger().debug( message );
               }
   
           }
  @@ -121,19 +126,15 @@
       /**
        * Convinience layer on top of restrict that returns the source files as
        * File objects (containing absolute paths if srcDir is absolute).
  -     *
  -     * @param files Description of Parameter
  -     * @param srcDir Description of Parameter
  -     * @param destDir Description of Parameter
  -     * @param mapper Description of Parameter
  -     * @return Description of the Returned Value
        */
  -    public File[] restrictAsFiles( String[] files, File srcDir, File destDir,
  -                                   FileNameMapper mapper )
  +    public File[] restrictAsFiles( final String[] files,
  +                                   final File srcDir,
  +                                   final File destDir,
  +                                   final FileNameMapper mapper )
           throws TaskException
       {
  -        String[] res = restrict( files, srcDir, destDir, mapper );
  -        File[] result = new File[ res.length ];
  +        final String[] res = restrict( files, srcDir, destDir, mapper );
  +        final File[] result = new File[ res.length ];
           for( int i = 0; i < res.length; i++ )
           {
               result[ i ] = new File( srcDir, res[ i ] );
  
  
  

--
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