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

FileUtils.directoryContains(File, File) returns wrong results when the file name contains unreadable characters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.4
    • None
    • Utilities
    • None
    • linux

    Description

      When testing for FileUtils.directoryContains(File, File) on a file which is in fact contained in the given directory but has odd characters in the name, the method returns wrong results.

      This file:

      File name
      bof@testcorso2015:~/tmp/test$ ls col* | xxd
      0000000: 636f 6c74 e00a                           colt..
      

      fails to be recognized as belonging to the current directory in this simple snippet of code:

      Snippet
      File[] files = new File(".").listFiles();
      for(File f : files){
           System.out.println("contains " + f + " = " + FileUtils.directoryContains(new File("."), f));
      }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            fedechicco Federico Bonelli
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: