commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adammurd...@apache.org
Subject cvs commit: jakarta-commons-sandbox/vfs/src/test/org/apache/commons/vfs/test AbstractFileSystemTestCase.java
Date Wed, 20 Nov 2002 23:57:13 GMT
adammurdoch    2002/11/20 15:57:13

  Modified:    vfs/src/java/org/apache/commons/vfs FileObject.java
               vfs/src/java/org/apache/commons/vfs/provider
                        AbstractFileObject.java
               vfs/src/java/org/apache/commons/vfs/tasks
                        AbstractSyncTask.java
               vfs/src/test/org/apache/commons/vfs/test
                        AbstractFileSystemTestCase.java
  Log:
  Changed FileObject.findFiles() to return FileObject[] rather than Collection, to be
  consistent with the other FileObject methods.
  
  Revision  Changes    Path
  1.13      +1 -2      jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/FileObject.java
  
  Index: FileObject.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/FileObject.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- FileObject.java	17 Nov 2002 03:39:20 -0000	1.12
  +++ FileObject.java	20 Nov 2002 23:57:13 -0000	1.13
  @@ -57,7 +57,6 @@
   
   import java.net.MalformedURLException;
   import java.net.URL;
  -import java.util.List;
   
   /**
    * Represents a file, and is used to access the content and
  @@ -259,7 +258,7 @@
        *
        * @todo Use the same return type for getChildren() and findFiles().
        */
  -    List findFiles( FileSelector selector ) throws FileSystemException;
  +    FileObject[] findFiles( FileSelector selector ) throws FileSystemException;
   
       /**
        * Deletes this file.  Does nothing if this file does not exist.  Does
  
  
  
  1.19      +2 -2      jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/AbstractFileObject.java
  
  Index: AbstractFileObject.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/AbstractFileObject.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- AbstractFileObject.java	17 Nov 2002 03:39:21 -0000	1.18
  +++ AbstractFileObject.java	20 Nov 2002 23:57:13 -0000	1.19
  @@ -739,11 +739,11 @@
        * Finds the set of matching descendents of this file, in depthwise
        * order.
        */
  -    public List findFiles( final FileSelector selector ) throws FileSystemException
  +    public FileObject[] findFiles( final FileSelector selector ) throws FileSystemException
       {
           final ArrayList list = new ArrayList();
           findFiles( selector, true, list );
  -        return list;
  +        return (FileObject[])list.toArray( new FileObject[ list.size() ] );
       }
   
       /**
  
  
  
  1.5       +11 -12    jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/tasks/AbstractSyncTask.java
  
  Index: AbstractSyncTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/tasks/AbstractSyncTask.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AbstractSyncTask.java	25 Oct 2002 03:59:10 -0000	1.4
  +++ AbstractSyncTask.java	20 Nov 2002 23:57:13 -0000	1.5
  @@ -57,7 +57,6 @@
   
   import java.util.ArrayList;
   import java.util.HashSet;
  -import java.util.List;
   import java.util.Set;
   import org.apache.commons.vfs.FileName;
   import org.apache.commons.vfs.FileObject;
  @@ -230,11 +229,10 @@
               else
               {
                   // Find matching files
  -                final List files = rootFile.findFiles( Selectors.SELECT_FILES );
  -                final int count = files.size();
  -                for ( int j = 0; j < count; j++ )
  +                final FileObject[] files = rootFile.findFiles( Selectors.SELECT_FILES );
  +                for ( int j = 0; j < files.length; j++ )
                   {
  -                    final FileObject srcFile = (FileObject)files.get( j );
  +                    final FileObject srcFile = files[ j ];
   
                       // Build the destination file name
                       final String relName =
  @@ -251,13 +249,14 @@
           // Scan the destination files for files with no source file
           if ( detectMissingSourceFiles() )
           {
  -            final List extraFiles = destFolder.findFiles( Selectors.SELECT_FILES );
  -            extraFiles.removeAll( destFiles );
  -            final int count = extraFiles.size();
  -            for ( int i = 0; i < count; i++ )
  +            final FileObject[] allDestFiles = destFolder.findFiles( Selectors.SELECT_FILES
);
  +            for ( int i = 0; i < allDestFiles.length; i++ )
               {
  -                final FileObject destFile = (FileObject)extraFiles.get( i );
  -                handleMissingSourceFile( destFile );
  +                final FileObject destFile = allDestFiles[ i ];
  +                if ( ! destFiles.contains( destFile ) )
  +                {
  +                    handleMissingSourceFile( destFile );
  +                }
               }
           }
       }
  
  
  
  1.18      +3 -3      jakarta-commons-sandbox/vfs/src/test/org/apache/commons/vfs/test/AbstractFileSystemTestCase.java
  
  Index: AbstractFileSystemTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/test/org/apache/commons/vfs/test/AbstractFileSystemTestCase.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- AbstractFileSystemTestCase.java	1 Nov 2002 03:29:31 -0000	1.17
  +++ AbstractFileSystemTestCase.java	20 Nov 2002 23:57:13 -0000	1.18
  @@ -1096,16 +1096,16 @@
           final VerifyingFileSelector selector = new VerifyingFileSelector( fileInfo );
   
           // Find the files
  -        final List actualFiles = baseFolder.findFiles( selector );
  +        final FileObject[] actualFiles = baseFolder.findFiles( selector );
   
           // Compare actual and expected list of files
           final List expectedFiles = selector.finish();
  -        assertEquals( expectedFiles.size(), actualFiles.size() );
  +        assertEquals( expectedFiles.size(), actualFiles.length );
           final int count = expectedFiles.size();
           for ( int i = 0; i < count; i++ )
           {
               final FileObject expected = (FileObject)expectedFiles.get( i );
  -            final FileObject actual = (FileObject)actualFiles.get( i );
  +            final FileObject actual = actualFiles[ i ];
               assertEquals( expected, actual );
           }
       }
  
  
  

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


Mime
View raw message