DO NOT REPLY [Bug 35150] New: - NullPointerException in FileUtils.listFiles

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

DO NOT REPLY [Bug 35150] New: - NullPointerException in FileUtils.listFiles

Bugzilla from bugzilla@apache.org
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG?
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=35150>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND?
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=35150

           Summary: NullPointerException in FileUtils.listFiles
           Product: Commons
           Version: 1.0 Final
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: IO
        AssignedTo: [hidden email]
        ReportedBy: [hidden email]


I get following error:
Exception in thread "main" java.lang.NullPointerException
        at org.apache.commons.io.FileUtils.innerListFiles(FileUtils.java:145)
        at org.apache.commons.io.FileUtils.innerListFiles(FileUtils.java:147)
        at org.apache.commons.io.FileUtils.listFiles(FileUtils.java:215)
        at test.Find.main(Find.java:17)

to reproduce:

$ mkdir /tmp/poa
$ touch /tmp/poa/ft-v05.2005-05-22.221500
$ java -cp .:/usr/local/lib/java/commons-io-1.0/commons-io-1.0.jar test.Find
Exception in thread "main" java.lang.NullPointerException
        at org.apache.commons.io.FileUtils.innerListFiles(FileUtils.java:145)
        at org.apache.commons.io.FileUtils.innerListFiles(FileUtils.java:147)
        at org.apache.commons.io.FileUtils.listFiles(FileUtils.java:215)
        at test.Find.main(Find.java:17)

test.Find:

package test;

import java.io.File;
import java.util.Collection;
import java.util.Iterator;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.FileFilterUtils;
import org.apache.commons.io.filefilter.IOFileFilter;
import org.apache.commons.io.filefilter.TrueFileFilter;

public class Find {

        public static void main(String[] args) {
                File rootDir = new File("/tmp/");
                IOFileFilter filter = FileFilterUtils.prefixFileFilter("ft-v05");
                Collection files = FileUtils.listFiles(rootDir, filter, TrueFileFilter.INSTANCE);
                for (Iterator i = files.iterator(); i.hasNext(); ) {
                        File f = (File)i.next();
                        System.out.println(f.getName());
                }
        }
}

--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]