commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kristian Rosenvold (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (IO-466) FileUtils.directoryContains returns wrong response due to startsWith comparison
Date Fri, 19 Jun 2015 17:33:00 GMT

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

Kristian Rosenvold commented on IO-466:
---------------------------------------

Added testcase in r1686461 that shows IO-423 fixed this too

> FileUtils.directoryContains returns wrong response due to startsWith comparison
> -------------------------------------------------------------------------------
>
>                 Key: IO-466
>                 URL: https://issues.apache.org/jira/browse/IO-466
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 2.4
>            Reporter: Ray Navarette
>
> Consider the following:
> {code:java}
> File fooDir = new File("/temp/foo");
> File fooFile = new File("/temp/foo.txt");
> FileUtils.directoryContains(fooDir, fooFile); // returns true, should return false
> {code}
> fooFile is a sibling of fooDir.  fooDir does not contain fooFile.
> This is due to the way FilenameUtils.directoryContains is implemented in that this method
uses a simple 'startsWith' comparison.  A related bug is filed for the FilenameUtils method
that I believe should be fixed as well.



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

Mime
View raw message