Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-281

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

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Invalid
    • Affects Version/s: 1.3.2
    • Fix Version/s: None
    • Component/s: Filters
    • Labels:
      None
    • Environment:

      Windows XP

      Description

      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);
      	}
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              dwschulze Dean Schulze
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: