commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark A Fortner <phidia...@yahoo.com>
Subject [VFS] Find Files Method Problem
Date Tue, 05 Dec 2006 22:02:29 GMT
I've been having problems implementing a simple FileSelector.  My goal is to find all children
of a given FileObject whose extension is "xyz".  Here's what I've got:

FileObject files[] = fo.findFiles(new FileDepthSelector(1,1)
        {
            public boolean includeFile(FileSelectInfo fileInfo){
                FileObject fo = fileInfo.getFile();
                return (fo.getName().getExtension().equalsIgnoreCase(ext));
            }

           
        });

When I add the code below, it throws an exception indicating that the list of files is null.

        if (files == null || files.length == 0){
            throw new FileSystemException("Unable to find file with extension: " + ext);
        }

When I debug this, it shows that the FileSelectInfo is actually looking at the parent and
not at the children.  According to the documentation the findFiles method is supposed to return
all of the children, but I don't see how it does this if the FileSelectInfo object that it
uses always points to the parent.

I've also tried creating my own FileSelector but it has the same results.

Does anyone have any ideas?

Mark


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message