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/taskdefs/file Move.java
Date Sun, 30 Dec 2001 00:07:09 GMT
donaldp     01/12/29 16:07:09

  Modified:    proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file
                        Move.java
  Log:
  Removed the ability of allowing pluggable log levels.
  
  Refactored creation of filtersets into new method
  
  Revision  Changes    Path
  1.9       +30 -24    jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Move.java
  
  Index: Move.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/file/Move.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Move.java	23 Dec 2001 14:22:45 -0000	1.8
  +++ Move.java	30 Dec 2001 00:07:09 -0000	1.9
  @@ -67,7 +67,7 @@
                   throw new TaskException( "UNEXPECTED ERROR - The file " + f.getAbsolutePath()
+ " should not exist!" );
               }
           }
  -        log( "Deleting directory " + d.getAbsolutePath(), getVerbosity() );
  +        getLogger().debug( "Deleting directory " + d.getAbsolutePath() );
           if( !d.delete() )
           {
               throw new TaskException( "Unable to delete directory " + d.getAbsolutePath()
);
  @@ -91,15 +91,15 @@
                   File toDir = (File)getCompleteDirMap().get( fromDir );
                   try
                   {
  -                    log( "Attempting to rename dir: " + fromDir +
  -                         " to " + toDir, getVerbosity() );
  +                    final String message = "Attempting to rename dir: " + fromDir +
  +                                             " to " + toDir;
  +                    getLogger().debug( message );
                       renameFile( fromDir, toDir, isFiltering(), isForceOverwrite() );
                   }
  -                catch( IOException ioe )
  +                catch( final IOException ioe )
                   {
  -                    String msg = "Failed to rename dir " + fromDir
  -                        + " to " + toDir
  -                        + " due to " + ioe.getMessage();
  +                    final String msg = "Failed to rename dir " + fromDir +
  +                        " to " + toDir + " due to " + ioe.getMessage();
                       throw new TaskException( msg, ioe );
                   }
               }
  @@ -117,7 +117,7 @@
   
                   if( fromFile.equals( toFile ) )
                   {
  -                    log( "Skipping self-move of " + fromFile, getVerbosity() );
  +                    getLogger().debug( "Skipping self-move of " + fromFile );
                       continue;
                   }
   
  @@ -130,15 +130,15 @@
   
                       try
                       {
  -                        log( "Attempting to rename: " + fromFile +
  -                             " to " + toFile, getVerbosity() );
  +                        final String message =
  +                            "Attempting to rename: " + fromFile + " to " + toFile;
  +                        getLogger().debug( message );
                           moved = renameFile( f, d, isFiltering(), isForceOverwrite() );
                       }
                       catch( IOException ioe )
                       {
  -                        String msg = "Failed to rename " + fromFile
  -                            + " to " + toFile
  -                            + " due to " + ioe.getMessage();
  +                        final String msg = "Failed to rename " + fromFile + " to " +
  +                            toFile + " due to " + ioe.getMessage();
                           throw new TaskException( msg, ioe );
                       }
   
  @@ -146,18 +146,9 @@
                       {
                           try
                           {
  -                            log( "Moving " + fromFile + " to " + toFile, getVerbosity()
);
  -
  -                            FilterSetCollection executionFilters = new FilterSetCollection();
  -                            if( isFiltering() )
  -                            {
  -                                executionFilters.addFilterSet( getProject().getGlobalFilterSet()
);
  -                            }
  -                            for( Iterator filterEnum = getFilterSets().iterator(); filterEnum.hasNext();
)
  -                            {
  -                                executionFilters.addFilterSet( (FilterSet)filterEnum.next()
);
  -                            }
  +                            getLogger().debug( "Moving " + fromFile + " to " + toFile );
   
  +                            final FilterSetCollection executionFilters = getFilters();
                               if( isForceOverwrite() )
                               {
                                   FileUtil.forceDelete( d );
  @@ -223,6 +214,21 @@
                   }
               }
           }
  +    }
  +
  +    private FilterSetCollection getFilters()
  +    {
  +        final FilterSetCollection executionFilters = new FilterSetCollection();
  +        if( isFiltering() )
  +        {
  +            executionFilters.addFilterSet( getProject().getGlobalFilterSet() );
  +        }
  +
  +        for( Iterator filterEnum = getFilterSets().iterator(); filterEnum.hasNext(); )
  +        {
  +            executionFilters.addFilterSet( (FilterSet)filterEnum.next() );
  +        }
  +        return executionFilters;
       }
   
       /**
  
  
  

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