commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Federico Bonelli (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (IO-498) FileUtils.directoryContains(File, File) returns wrong results when the file name contains unreadable characters
Date Fri, 12 Feb 2016 16:28:18 GMT

    [ https://issues.apache.org/jira/browse/IO-498?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15144797#comment-15144797
] 

Federico Bonelli commented on IO-498:
-------------------------------------

Is it worth noticing that in this case the method fails because of what I think being a JVM
bug.

The snippet
{code}
File[] files = new File(".").listFiles();
for(File f : files){
     System.out.println("exists: " + f.exists());
}
{code}

shows that with an ill formed name as the one I'm using the File class is not able to work
properly.
The same file object returned by listFiles() is said to be unexistant.

> FileUtils.directoryContains(File, File) returns wrong results when the file name contains
unreadable characters
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: IO-498
>                 URL: https://issues.apache.org/jira/browse/IO-498
>             Project: Commons IO
>          Issue Type: Bug
>    Affects Versions: 2.4
>         Environment: linux
>            Reporter: Federico Bonelli
>
> 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:
> {code:title=File name}
> bof@testcorso2015:~/tmp/test$ ls col* | xxd
> 0000000: 636f 6c74 e00a                           colt..
> {code}
> fails to be recognized as belonging to the current directory in this simple snippet of
code:
> {code:title=Snippet|borderStyle=solid}
> File[] files = new File(".").listFiles();
> for(File f : files){
>      System.out.println("contains " + f + " = " + FileUtils.directoryContains(new File("."),
f));
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message