commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 25742] New: - jakarta-commons-io FileUtils.listFiles(File, String[], boolean) throws NullPointerException when the second parameter is null
Date Wed, 24 Dec 2003 10:51:22 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25742>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25742

jakarta-commons-io FileUtils.listFiles(File, String[], boolean) throws NullPointerException
when the second parameter is null

           Summary: jakarta-commons-io FileUtils.listFiles(File, String[],
                    boolean) throws NullPointerException when the second
                    parameter is null
           Product: Commons
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Sandbox
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: ignat@tiger.unisquad.com


jakarta-commons-io FileUtils.listFiles(File, String[], boolean) throws
NullPointerException when the second parameter is null. But the javadoc says it
should list all files in such a case.

Here is the patch:

--- FileUtils.java.orig	2003-12-24 12:35:06.000000000 +0200
+++ FileUtils.java	2003-12-24 12:28:22.000000000 +0200
@@ -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