You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2003/12/24 11:51:22 UTC
DO NOT REPLY [Bug 25742] New: -
jakarta-commons-io FileUtils.listFiles(File, String[], boolean) throws NullPointerException when the second parameter is null
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