You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Mark Leonard (Created) (JIRA)" <ji...@apache.org> on 2012/01/06 16:03:39 UTC
[jira] [Created] (VFS-398) FtpFileObject.getChildren() fails when a
folder contains a file with a colon in the name
FtpFileObject.getChildren() fails when a folder contains a file with a colon in the name
----------------------------------------------------------------------------------------
Key: VFS-398
URL: https://issues.apache.org/jira/browse/VFS-398
Project: Commons VFS
Issue Type: Bug
Affects Versions: 2.0
Environment: Connecting via FTP to a host running SunOS 5.10
Reporter: Mark Leonard
Priority: Blocker
Fix For: 2.0
In line 767 of DefaultFileSystemManager.java the UriParser's extractScheme() method is called:
String scheme = UriParser.extractScheme(buffer.toString());
This code was added in revision 780730
http://svn.apache.org/viewvc?view=revision&revision=780730
It is not clear to me why this change was made.
For the FTP provider, buffer contains a plain file name (i.e. without a path and definitely not in URI form)
A colon is a valid character for a file name.
However a colon will be interpreted as a URI scheme name.
This causes an exception when the resolved path is checked using AbstractFileName.checkName()
Sample code:
FileObject fo = VFS.getManager().resolveFile("ftp://user:pass@host/some/path/some.file");
fo.getParent().getChildren();
If /some/path/ contains a child such as PREFIX:SUFFIX then an exception is thrown:
Exception in thread "main" org.apache.commons.vfs2.FileSystemException: Invalid descendent file name "PREFIX:SUFFIX".
at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveName(DefaultFileSystemManager.java:791)
at org.apache.commons.vfs2.provider.AbstractFileObject.getChildren(AbstractFileObject.java:710)
at org.apache.commons.vfs2.provider.ftp.FtpFileObject.getChildren(FtpFileObject.java:420)
Therefore calling code is unable to list the children of the specified folder.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (VFS-398) FtpFileObject.getChildren() fails when a
folder contains a file with a colon in the name
Posted by "Gary D. Gregory (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/VFS-398?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gary D. Gregory updated VFS-398:
--------------------------------
Fix Version/s: (was: 2.0)
2.1
> FtpFileObject.getChildren() fails when a folder contains a file with a colon in the name
> ----------------------------------------------------------------------------------------
>
> Key: VFS-398
> URL: https://issues.apache.org/jira/browse/VFS-398
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: 2.0
> Environment: Connecting via FTP to a host running SunOS 5.10
> Reporter: Mark Leonard
> Priority: Blocker
> Fix For: 2.1
>
>
> In line 767 of DefaultFileSystemManager.java the UriParser's extractScheme() method is called:
> String scheme = UriParser.extractScheme(buffer.toString());
> This code was added in revision 780730
> http://svn.apache.org/viewvc?view=revision&revision=780730
> It is not clear to me why this change was made.
> For the FTP provider, buffer contains a plain file name (i.e. without a path and definitely not in URI form)
> A colon is a valid character for a file name.
> However a colon will be interpreted as a URI scheme name.
> This causes an exception when the resolved path is checked using AbstractFileName.checkName()
> Sample code:
> FileObject fo = VFS.getManager().resolveFile("ftp://user:pass@host/some/path/some.file");
> fo.getParent().getChildren();
> If /some/path/ contains a child such as PREFIX:SUFFIX then an exception is thrown:
> Exception in thread "main" org.apache.commons.vfs2.FileSystemException: Invalid descendent file name "PREFIX:SUFFIX".
> at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveName(DefaultFileSystemManager.java:791)
> at org.apache.commons.vfs2.provider.AbstractFileObject.getChildren(AbstractFileObject.java:710)
> at org.apache.commons.vfs2.provider.ftp.FtpFileObject.getChildren(FtpFileObject.java:420)
> Therefore calling code is unable to list the children of the specified folder.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (VFS-398) FtpFileObject.getChildren() fails when
a folder contains a file with a colon in the name
Posted by "Mark Leonard (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/VFS-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13181372#comment-13181372 ]
Mark Leonard commented on VFS-398:
----------------------------------
I searched for existing issues and found only the following:
VFS-312 (relating to creation of a file with a colon in the name on Windows)
VFS-376 (which mentions normalization of a URI that contains a colon character)
As an aside, I looked at RFC1378 and this confirms that a colon is valid in the path element of the FTP URI scheme. This isn't really relevant to the issue I've raised, which concerns treating a plain file name as a URI.
> FtpFileObject.getChildren() fails when a folder contains a file with a colon in the name
> ----------------------------------------------------------------------------------------
>
> Key: VFS-398
> URL: https://issues.apache.org/jira/browse/VFS-398
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: 2.0
> Environment: Connecting via FTP to a host running SunOS 5.10
> Reporter: Mark Leonard
> Priority: Blocker
> Fix For: 2.0
>
>
> In line 767 of DefaultFileSystemManager.java the UriParser's extractScheme() method is called:
> String scheme = UriParser.extractScheme(buffer.toString());
> This code was added in revision 780730
> http://svn.apache.org/viewvc?view=revision&revision=780730
> It is not clear to me why this change was made.
> For the FTP provider, buffer contains a plain file name (i.e. without a path and definitely not in URI form)
> A colon is a valid character for a file name.
> However a colon will be interpreted as a URI scheme name.
> This causes an exception when the resolved path is checked using AbstractFileName.checkName()
> Sample code:
> FileObject fo = VFS.getManager().resolveFile("ftp://user:pass@host/some/path/some.file");
> fo.getParent().getChildren();
> If /some/path/ contains a child such as PREFIX:SUFFIX then an exception is thrown:
> Exception in thread "main" org.apache.commons.vfs2.FileSystemException: Invalid descendent file name "PREFIX:SUFFIX".
> at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveName(DefaultFileSystemManager.java:791)
> at org.apache.commons.vfs2.provider.AbstractFileObject.getChildren(AbstractFileObject.java:710)
> at org.apache.commons.vfs2.provider.ftp.FtpFileObject.getChildren(FtpFileObject.java:420)
> Therefore calling code is unable to list the children of the specified folder.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (VFS-398) FtpFileObject.getChildren() fails when
a folder contains a file with a colon in the name
Posted by "Mark Leonard (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/VFS-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13181403#comment-13181403 ]
Mark Leonard commented on VFS-398:
----------------------------------
A quick solution might be to escape the colon character when the file name is URI encoded
FtpFileObject.doListChildren() calls UriParser.encode(childNames)
In the following method:
public static String encode(final String decodedStr)
{
return encode(decodedStr, null);
}
The set of "reserved" (meaning "to be encoded") characters is null - should a colon be considered "reserved"?
> FtpFileObject.getChildren() fails when a folder contains a file with a colon in the name
> ----------------------------------------------------------------------------------------
>
> Key: VFS-398
> URL: https://issues.apache.org/jira/browse/VFS-398
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: 2.0
> Environment: Connecting via FTP to a host running SunOS 5.10
> Reporter: Mark Leonard
> Priority: Blocker
> Fix For: 2.0
>
>
> In line 767 of DefaultFileSystemManager.java the UriParser's extractScheme() method is called:
> String scheme = UriParser.extractScheme(buffer.toString());
> This code was added in revision 780730
> http://svn.apache.org/viewvc?view=revision&revision=780730
> It is not clear to me why this change was made.
> For the FTP provider, buffer contains a plain file name (i.e. without a path and definitely not in URI form)
> A colon is a valid character for a file name.
> However a colon will be interpreted as a URI scheme name.
> This causes an exception when the resolved path is checked using AbstractFileName.checkName()
> Sample code:
> FileObject fo = VFS.getManager().resolveFile("ftp://user:pass@host/some/path/some.file");
> fo.getParent().getChildren();
> If /some/path/ contains a child such as PREFIX:SUFFIX then an exception is thrown:
> Exception in thread "main" org.apache.commons.vfs2.FileSystemException: Invalid descendent file name "PREFIX:SUFFIX".
> at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveName(DefaultFileSystemManager.java:791)
> at org.apache.commons.vfs2.provider.AbstractFileObject.getChildren(AbstractFileObject.java:710)
> at org.apache.commons.vfs2.provider.ftp.FtpFileObject.getChildren(FtpFileObject.java:420)
> Therefore calling code is unable to list the children of the specified folder.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (VFS-398) FtpFileObject.getChildren() fails when
a folder contains a file with a colon in the name
Posted by "Gary Gregory (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/VFS-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13502293#comment-13502293 ]
Gary Gregory commented on VFS-398:
----------------------------------
Since Ralph committed http://svn.apache.org/viewvc?view=revision&revision=780730 I'd like to hear his take on this patch.
> FtpFileObject.getChildren() fails when a folder contains a file with a colon in the name
> ----------------------------------------------------------------------------------------
>
> Key: VFS-398
> URL: https://issues.apache.org/jira/browse/VFS-398
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: 2.0
> Environment: Connecting via FTP to a host running SunOS 5.10
> Reporter: Mark Leonard
> Priority: Blocker
> Fix For: 2.1
>
>
> In line 767 of DefaultFileSystemManager.java the UriParser's extractScheme() method is called:
> String scheme = UriParser.extractScheme(buffer.toString());
> This code was added in revision 780730
> http://svn.apache.org/viewvc?view=revision&revision=780730
> It is not clear to me why this change was made.
> For the FTP provider, buffer contains a plain file name (i.e. without a path and definitely not in URI form)
> A colon is a valid character for a file name.
> However a colon will be interpreted as a URI scheme name.
> This causes an exception when the resolved path is checked using AbstractFileName.checkName()
> Sample code:
> FileObject fo = VFS.getManager().resolveFile("ftp://user:pass@host/some/path/some.file");
> fo.getParent().getChildren();
> If /some/path/ contains a child such as PREFIX:SUFFIX then an exception is thrown:
> Exception in thread "main" org.apache.commons.vfs2.FileSystemException: Invalid descendent file name "PREFIX:SUFFIX".
> at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveName(DefaultFileSystemManager.java:791)
> at org.apache.commons.vfs2.provider.AbstractFileObject.getChildren(AbstractFileObject.java:710)
> at org.apache.commons.vfs2.provider.ftp.FtpFileObject.getChildren(FtpFileObject.java:420)
> Therefore calling code is unable to list the children of the specified folder.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (VFS-398) FtpFileObject.getChildren() fails when
a folder contains a file with a colon in the name
Posted by "Mark Leonard (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/VFS-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13182660#comment-13182660 ]
Mark Leonard commented on VFS-398:
----------------------------------
A similar error occurs using the SFTP provider:
Exception in thread "main" org.apache.commons.vfs2.FileSystemException: Invalid descendent file name "PREFIX:SUFFIX".
at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveName(DefaultFileSystemManager.java:791)
at org.apache.commons.vfs2.provider.sftp.SftpFileObject.doListChildrenResolved(SftpFileObject.java:395)
at org.apache.commons.vfs2.provider.AbstractFileObject.getChildren(AbstractFileObject.java:654)
> FtpFileObject.getChildren() fails when a folder contains a file with a colon in the name
> ----------------------------------------------------------------------------------------
>
> Key: VFS-398
> URL: https://issues.apache.org/jira/browse/VFS-398
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: 2.0
> Environment: Connecting via FTP to a host running SunOS 5.10
> Reporter: Mark Leonard
> Priority: Blocker
> Fix For: 2.0
>
>
> In line 767 of DefaultFileSystemManager.java the UriParser's extractScheme() method is called:
> String scheme = UriParser.extractScheme(buffer.toString());
> This code was added in revision 780730
> http://svn.apache.org/viewvc?view=revision&revision=780730
> It is not clear to me why this change was made.
> For the FTP provider, buffer contains a plain file name (i.e. without a path and definitely not in URI form)
> A colon is a valid character for a file name.
> However a colon will be interpreted as a URI scheme name.
> This causes an exception when the resolved path is checked using AbstractFileName.checkName()
> Sample code:
> FileObject fo = VFS.getManager().resolveFile("ftp://user:pass@host/some/path/some.file");
> fo.getParent().getChildren();
> If /some/path/ contains a child such as PREFIX:SUFFIX then an exception is thrown:
> Exception in thread "main" org.apache.commons.vfs2.FileSystemException: Invalid descendent file name "PREFIX:SUFFIX".
> at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveName(DefaultFileSystemManager.java:791)
> at org.apache.commons.vfs2.provider.AbstractFileObject.getChildren(AbstractFileObject.java:710)
> at org.apache.commons.vfs2.provider.ftp.FtpFileObject.getChildren(FtpFileObject.java:420)
> Therefore calling code is unable to list the children of the specified folder.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (VFS-398) FtpFileObject.getChildren() fails when
a folder contains a file with a colon in the name
Posted by "Paul (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/VFS-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13206014#comment-13206014 ]
Paul commented on VFS-398:
--------------------------
As a user of the API, this is in the context of FtpFileObject.getChildren() so it is not possible to percent-encode. From Mark's findings, it looks like this is a major bug that has to be fixed internally right?
> FtpFileObject.getChildren() fails when a folder contains a file with a colon in the name
> ----------------------------------------------------------------------------------------
>
> Key: VFS-398
> URL: https://issues.apache.org/jira/browse/VFS-398
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: 2.0
> Environment: Connecting via FTP to a host running SunOS 5.10
> Reporter: Mark Leonard
> Priority: Blocker
> Fix For: 2.0
>
>
> In line 767 of DefaultFileSystemManager.java the UriParser's extractScheme() method is called:
> String scheme = UriParser.extractScheme(buffer.toString());
> This code was added in revision 780730
> http://svn.apache.org/viewvc?view=revision&revision=780730
> It is not clear to me why this change was made.
> For the FTP provider, buffer contains a plain file name (i.e. without a path and definitely not in URI form)
> A colon is a valid character for a file name.
> However a colon will be interpreted as a URI scheme name.
> This causes an exception when the resolved path is checked using AbstractFileName.checkName()
> Sample code:
> FileObject fo = VFS.getManager().resolveFile("ftp://user:pass@host/some/path/some.file");
> fo.getParent().getChildren();
> If /some/path/ contains a child such as PREFIX:SUFFIX then an exception is thrown:
> Exception in thread "main" org.apache.commons.vfs2.FileSystemException: Invalid descendent file name "PREFIX:SUFFIX".
> at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveName(DefaultFileSystemManager.java:791)
> at org.apache.commons.vfs2.provider.AbstractFileObject.getChildren(AbstractFileObject.java:710)
> at org.apache.commons.vfs2.provider.ftp.FtpFileObject.getChildren(FtpFileObject.java:420)
> Therefore calling code is unable to list the children of the specified folder.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (VFS-398) FtpFileObject.getChildren() fails when
a folder contains a file with a colon in the name
Posted by "Mark Leonard (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/VFS-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13502307#comment-13502307 ]
Mark Leonard commented on VFS-398:
----------------------------------
Sorry - I meant to type RFC1738 which is the Uniform Resource Locators (URL) specification
> FtpFileObject.getChildren() fails when a folder contains a file with a colon in the name
> ----------------------------------------------------------------------------------------
>
> Key: VFS-398
> URL: https://issues.apache.org/jira/browse/VFS-398
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: 2.0
> Environment: Connecting via FTP to a host running SunOS 5.10
> Reporter: Mark Leonard
> Priority: Blocker
> Fix For: 2.1
>
>
> In line 767 of DefaultFileSystemManager.java the UriParser's extractScheme() method is called:
> String scheme = UriParser.extractScheme(buffer.toString());
> This code was added in revision 780730
> http://svn.apache.org/viewvc?view=revision&revision=780730
> It is not clear to me why this change was made.
> For the FTP provider, buffer contains a plain file name (i.e. without a path and definitely not in URI form)
> A colon is a valid character for a file name.
> However a colon will be interpreted as a URI scheme name.
> This causes an exception when the resolved path is checked using AbstractFileName.checkName()
> Sample code:
> FileObject fo = VFS.getManager().resolveFile("ftp://user:pass@host/some/path/some.file");
> fo.getParent().getChildren();
> If /some/path/ contains a child such as PREFIX:SUFFIX then an exception is thrown:
> Exception in thread "main" org.apache.commons.vfs2.FileSystemException: Invalid descendent file name "PREFIX:SUFFIX".
> at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveName(DefaultFileSystemManager.java:791)
> at org.apache.commons.vfs2.provider.AbstractFileObject.getChildren(AbstractFileObject.java:710)
> at org.apache.commons.vfs2.provider.ftp.FtpFileObject.getChildren(FtpFileObject.java:420)
> Therefore calling code is unable to list the children of the specified folder.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (VFS-398) FtpFileObject.getChildren() fails when
a folder contains a file with a colon in the name
Posted by "Gary Gregory (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/VFS-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13502278#comment-13502278 ]
Gary Gregory commented on VFS-398:
----------------------------------
The issue description mentions RFC1378 which is... AppleTalk? That must be a typo.
> FtpFileObject.getChildren() fails when a folder contains a file with a colon in the name
> ----------------------------------------------------------------------------------------
>
> Key: VFS-398
> URL: https://issues.apache.org/jira/browse/VFS-398
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: 2.0
> Environment: Connecting via FTP to a host running SunOS 5.10
> Reporter: Mark Leonard
> Priority: Blocker
> Fix For: 2.1
>
>
> In line 767 of DefaultFileSystemManager.java the UriParser's extractScheme() method is called:
> String scheme = UriParser.extractScheme(buffer.toString());
> This code was added in revision 780730
> http://svn.apache.org/viewvc?view=revision&revision=780730
> It is not clear to me why this change was made.
> For the FTP provider, buffer contains a plain file name (i.e. without a path and definitely not in URI form)
> A colon is a valid character for a file name.
> However a colon will be interpreted as a URI scheme name.
> This causes an exception when the resolved path is checked using AbstractFileName.checkName()
> Sample code:
> FileObject fo = VFS.getManager().resolveFile("ftp://user:pass@host/some/path/some.file");
> fo.getParent().getChildren();
> If /some/path/ contains a child such as PREFIX:SUFFIX then an exception is thrown:
> Exception in thread "main" org.apache.commons.vfs2.FileSystemException: Invalid descendent file name "PREFIX:SUFFIX".
> at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveName(DefaultFileSystemManager.java:791)
> at org.apache.commons.vfs2.provider.AbstractFileObject.getChildren(AbstractFileObject.java:710)
> at org.apache.commons.vfs2.provider.ftp.FtpFileObject.getChildren(FtpFileObject.java:420)
> Therefore calling code is unable to list the children of the specified folder.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (VFS-398) FtpFileObject.getChildren() fails when
a folder contains a file with a colon in the name
Posted by "Gary D. Gregory (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/VFS-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13196346#comment-13196346 ]
Gary D. Gregory commented on VFS-398:
-------------------------------------
Try to percent-encode the reserved URI character ":" according to RFC3986 (https://tools.ietf.org/html/rfc3986)?
For example: "ftp://user:pass@host/some/path/some%3Afile" instead of "ftp://user:pass@host/some/path/some:file"
> FtpFileObject.getChildren() fails when a folder contains a file with a colon in the name
> ----------------------------------------------------------------------------------------
>
> Key: VFS-398
> URL: https://issues.apache.org/jira/browse/VFS-398
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: 2.0
> Environment: Connecting via FTP to a host running SunOS 5.10
> Reporter: Mark Leonard
> Priority: Blocker
> Fix For: 2.0
>
>
> In line 767 of DefaultFileSystemManager.java the UriParser's extractScheme() method is called:
> String scheme = UriParser.extractScheme(buffer.toString());
> This code was added in revision 780730
> http://svn.apache.org/viewvc?view=revision&revision=780730
> It is not clear to me why this change was made.
> For the FTP provider, buffer contains a plain file name (i.e. without a path and definitely not in URI form)
> A colon is a valid character for a file name.
> However a colon will be interpreted as a URI scheme name.
> This causes an exception when the resolved path is checked using AbstractFileName.checkName()
> Sample code:
> FileObject fo = VFS.getManager().resolveFile("ftp://user:pass@host/some/path/some.file");
> fo.getParent().getChildren();
> If /some/path/ contains a child such as PREFIX:SUFFIX then an exception is thrown:
> Exception in thread "main" org.apache.commons.vfs2.FileSystemException: Invalid descendent file name "PREFIX:SUFFIX".
> at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveName(DefaultFileSystemManager.java:791)
> at org.apache.commons.vfs2.provider.AbstractFileObject.getChildren(AbstractFileObject.java:710)
> at org.apache.commons.vfs2.provider.ftp.FtpFileObject.getChildren(FtpFileObject.java:420)
> Therefore calling code is unable to list the children of the specified folder.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (VFS-398) FtpFileObject.getChildren() fails when
a folder contains a file with a colon in the name
Posted by "Paul (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/VFS-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13195075#comment-13195075 ]
Paul commented on VFS-398:
--------------------------
This happens to be a show stopper for my app since many files have a colon in the name.
org.apache.commons.vfs2.FileSystemException: Invalid descendent file name "jcr:lastModified.txt".
at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveName(DefaultFileSystemManager.java:791)
Is there a workaround?
> FtpFileObject.getChildren() fails when a folder contains a file with a colon in the name
> ----------------------------------------------------------------------------------------
>
> Key: VFS-398
> URL: https://issues.apache.org/jira/browse/VFS-398
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: 2.0
> Environment: Connecting via FTP to a host running SunOS 5.10
> Reporter: Mark Leonard
> Priority: Blocker
> Fix For: 2.0
>
>
> In line 767 of DefaultFileSystemManager.java the UriParser's extractScheme() method is called:
> String scheme = UriParser.extractScheme(buffer.toString());
> This code was added in revision 780730
> http://svn.apache.org/viewvc?view=revision&revision=780730
> It is not clear to me why this change was made.
> For the FTP provider, buffer contains a plain file name (i.e. without a path and definitely not in URI form)
> A colon is a valid character for a file name.
> However a colon will be interpreted as a URI scheme name.
> This causes an exception when the resolved path is checked using AbstractFileName.checkName()
> Sample code:
> FileObject fo = VFS.getManager().resolveFile("ftp://user:pass@host/some/path/some.file");
> fo.getParent().getChildren();
> If /some/path/ contains a child such as PREFIX:SUFFIX then an exception is thrown:
> Exception in thread "main" org.apache.commons.vfs2.FileSystemException: Invalid descendent file name "PREFIX:SUFFIX".
> at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveName(DefaultFileSystemManager.java:791)
> at org.apache.commons.vfs2.provider.AbstractFileObject.getChildren(AbstractFileObject.java:710)
> at org.apache.commons.vfs2.provider.ftp.FtpFileObject.getChildren(FtpFileObject.java:420)
> Therefore calling code is unable to list the children of the specified folder.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (VFS-398) FtpFileObject.getChildren() fails when
a folder contains a file with a colon in the name
Posted by "Vincent Bonamy (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/VFS-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13502213#comment-13502213 ]
Vincent Bonamy commented on VFS-398:
------------------------------------
Hello,
As Mark Leonard said, the goal of the commit 780730 is not very clear for me too.
And this issue broke my app so that I had to fork commons-vfs2-project-2.0
You can see the patch/diff I make on github here :
https://github.com/vbonamy/commons-vfs2-project-2.0/commit/43de7e38a6a27f846c034eb3b824edd2e3b0fe12
It would be nice if this issue can find a resolution. Maybe my patch can be applied simply ?
Thanks,
Vincent.
> FtpFileObject.getChildren() fails when a folder contains a file with a colon in the name
> ----------------------------------------------------------------------------------------
>
> Key: VFS-398
> URL: https://issues.apache.org/jira/browse/VFS-398
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: 2.0
> Environment: Connecting via FTP to a host running SunOS 5.10
> Reporter: Mark Leonard
> Priority: Blocker
> Fix For: 2.1
>
>
> In line 767 of DefaultFileSystemManager.java the UriParser's extractScheme() method is called:
> String scheme = UriParser.extractScheme(buffer.toString());
> This code was added in revision 780730
> http://svn.apache.org/viewvc?view=revision&revision=780730
> It is not clear to me why this change was made.
> For the FTP provider, buffer contains a plain file name (i.e. without a path and definitely not in URI form)
> A colon is a valid character for a file name.
> However a colon will be interpreted as a URI scheme name.
> This causes an exception when the resolved path is checked using AbstractFileName.checkName()
> Sample code:
> FileObject fo = VFS.getManager().resolveFile("ftp://user:pass@host/some/path/some.file");
> fo.getParent().getChildren();
> If /some/path/ contains a child such as PREFIX:SUFFIX then an exception is thrown:
> Exception in thread "main" org.apache.commons.vfs2.FileSystemException: Invalid descendent file name "PREFIX:SUFFIX".
> at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveName(DefaultFileSystemManager.java:791)
> at org.apache.commons.vfs2.provider.AbstractFileObject.getChildren(AbstractFileObject.java:710)
> at org.apache.commons.vfs2.provider.ftp.FtpFileObject.getChildren(FtpFileObject.java:420)
> Therefore calling code is unable to list the children of the specified folder.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira