WildcardFileFilter fails for wild card pattern with a '*' in it
---------------------------------------------------------------

                 Key: IO-281
                 URL: https://issues.apache.org/jira/browse/IO-281
             Project: Commons IO
          Issue Type: Bug
          Components: Filters
    Affects Versions: 1.3.2
         Environment: Windows XP
            Reporter: Dean Schulze
            Priority: Blocker


The code below reports no files found when there is a file matching the wild 
card pattern.  If I enter this command in a DOS windows in the same directory 
it finds the file so the wild card pattern is correct as far as DOS is 
concerned:


C:\dean\clipper\src\metadata.mail>dir 320620110821433-*.RWD
 
 Directory of C:\dean\clipper\src\metadata.mail

08/22/2011  12:36 PM             9,728 320620110821433-1.RWD
               1 File(s)          9,728 bytes
               0 Dir(s)  50,033,049,600 bytes free

This code should work according to the docs but it reports no file found:


        void testFileNameFilter() throws IOException {
                
                String fileNamePrefix = "320620110821433";
                File f = new File(fileNamePrefix + ".rwd");
                String filterString = fileNamePrefix + "-*.RWD";
                FileFilter filter = new WildcardFileFilter(filterString, 
IOCase.SYSTEM);
                File dir = f.getCanonicalFile();
                File[] existingFiles = dir.listFiles(filter);
                
                if (existingFiles != null)
                        for (File f2 : existingFiles)
                                System.out.println(f2.getName());
                else
                        System.out.println("No files found for" + filterString);
        }



--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to