You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Larry Reeve (JIRA)" <ji...@apache.org> on 2010/12/13 03:12:01 UTC

[jira] Updated: (VFS-325) Bad handling of hashs (#) in file names when walking a file tree using findFiles()

     [ https://issues.apache.org/jira/browse/VFS-325?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Larry Reeve updated VFS-325:
----------------------------

    Attachment: PATCH-vfs-325.tar

Attached is archive submission of patch file and new files to resolve this issue.

New files are:
1) core/src/test/java/org/apache/commons/vfs2/provider/local/test/UrlTests.java
This a source file containing new unit tests around URL handling for this issue.

2) core/src/test/resources/test-data/test-hash-#test.txt
A test file to test the FindFiles operation as part of the unit test.


Patched source files are:
1) core/src/test/java/org/apache/commons/vfs2/provider/local/test/LocalProviderTestCase.java
Add new URL test cases.

2) core/src/main/java/org/apache/commons/vfs2/provider/local/LocalFile.java
Overrides getURL() method in abstract base class AbstractFileObject.java for local files.

3) core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java
Exposes VfsComponentContext for use in LocalFile.java

> Bad handling of hashs (#) in file names when walking a file tree using findFiles()
> ----------------------------------------------------------------------------------
>
>                 Key: VFS-325
>                 URL: https://issues.apache.org/jira/browse/VFS-325
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 1.0, 1.1, 2.0
>         Environment: Windows Seven, JDK 1.6 64 bit
>            Reporter: Nicolas Guillaumin
>         Attachments: PATCH-vfs-325.tar
>
>
> Consider a local directory tree containing files with hashs in their name, such as {{test-hash-#.txt}}.
> When walking the tree using FileObject.findFiles(), the file is correctly found and returned, but it's URL is truncated to the #: {{test-hash-}}
> * Calling file.getURL().toString() returns {{file://my/dir/test-hash-}}
> * Calling file.toString() returns the correct URL {{file://my/dir/test-hash-#.txt}}
> * For the sake of testing, calling new URL("http://my/file/with/hash-#.txt").toString() returns {{http://my/file/with/hash-#.txt}} (It's not an java.net.URL problem)
> I think file.getURL().toString() should return {{test-hash-#.txt}}, otherwise caller have to rely on file.toString() to retrieve the URL of the file, which is probably bad.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.