commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerem...@apache.org
Subject cvs commit: jakarta-commons-sandbox/io/src/java/org/apache/commons/io FileUtils.java
Date Thu, 25 Dec 2003 11:05:59 GMT
jeremias    2003/12/25 03:05:59

  Modified:    io/src/java/org/apache/commons/io FileUtils.java
  Log:
  BugZilla #25742:
  Change listFiles so its behaviour matches the javadocs.
  Fixes NPE when extension is null.
  Submitted by: Ignat Skoryh <ignat.at.tiger.unisquad.com>
  
  Revision  Changes    Path
  1.20      +8 -3      jakarta-commons-sandbox/io/src/java/org/apache/commons/io/FileUtils.java
  
  Index: FileUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/io/src/java/org/apache/commons/io/FileUtils.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- FileUtils.java	23 Nov 2003 20:43:30 -0000	1.19
  +++ FileUtils.java	25 Dec 2003 11:05:59 -0000	1.20
  @@ -276,8 +276,13 @@
        * @return an collection of java.io.File with the matching files
        */
       public static Collection listFiles(File directory, String[] extensions, boolean recursive)
{
  -        String[] suffixes = toSuffixes(extensions);
  -        IOFileFilter filter = new SuffixFileFilter(suffixes);
  +        IOFileFilter filter;
  +        if (extensions == null) {
  +            filter = TrueFileFilter.INSTANCE;
  +        } else {
  +            String[] suffixes = toSuffixes(extensions);
  +            filter = new SuffixFileFilter(suffixes);
  +        }
           return listFiles(directory, filter, 
               (recursive ? TrueFileFilter.INSTANCE : FalseFileFilter.INSTANCE));
       }
  
  
  

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


Mime
View raw message