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

Bernd Eckenfels commented on VFS-573:
-------------------------------------

Thanks for the report. The behavior of the FTP provider (or of VFS) of querying 
the parent for the addressed child does not only create problems if the dir is 
hidden, but also with things like relative path or larger directories. So it 
would be nice if we can avoid/reduce this parent usage. However I am not sure 
if it is that easy. If somebody wants to look at this, please propose your 
strategy on commons-dev ML. 

> hidden directory on FTP handled incorrectly
> -------------------------------------------
>
>                 Key: VFS-573
>                 URL: https://issues.apache.org/jira/browse/VFS-573
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 2.0
>         Environment: commons-net-3.2
>            Reporter: Jeroen Douwes
>
> We encounter problems when trying to create a file in a hidden directory 
> using FTP. The actual bug is that the FileType of the hidden directory is 
> IMAGINARY and VFS thinks the directory does not exist.
> Before writing the file VFS checks if the parent directory exists using 
> AbstractFileObject.getType() (AbstractFileObject:1418).
> In FtpFileObject.getInfo(boolean flush) VFS tries to obtain the fileInfo 
> (FTPFile) of the directory using FtpFileObject.getChildFile(final String 
> name, final boolean flush) on the parent. But since the directory is hidden 
> it returns null and the fileInfo is set to UNKNOWN..
> FtpFileObject.doGetType() translates the UNKNOWN to FileType.IMAGINARY.
> VFS now tries to create the directory which fails because it already exists 
> (AbstractFileObject:1424) and creating the OutputStream is aborted with the 
> following exception:
> Exception in thread "main" org.apache.commons.vfs2.FileSystemException: Could 
> not create folder "ftp://localhost/hiddenmap";.
>       at 
> org.apache.commons.vfs2.provider.AbstractFileObject.createFolder(AbstractFileObject.java:999)
>       at 
> org.apache.commons.vfs2.provider.AbstractFileObject.getOutputStream(AbstractFileObject.java:1424)
>       at 
> org.apache.commons.vfs2.provider.DefaultFileContent.getOutputStream(DefaultFileContent.java:461)
>       at 
> org.apache.commons.vfs2.provider.DefaultFileContent.getOutputStream(DefaultFileContent.java:441)
> Caused by: org.apache.commons.vfs2.FileSystemException: Could not create FTP 
> directory "ftp://localhost/hiddenmap";.
>       at 
> org.apache.commons.vfs2.provider.ftp.FtpFileObject.doCreateFolder(FtpFileObject.java:544)
>       at 
> org.apache.commons.vfs2.provider.AbstractFileObject.createFolder(AbstractFileObject.java:988)
>       ... 5 more



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

Reply via email to