You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Jeroen Douwes (JIRA)" <ji...@apache.org> on 2015/06/22 14:43:00 UTC

[jira] [Updated] (VFS-573) hidden directory on FTP handled incorrectly

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

Jeroen Douwes updated VFS-573:
------------------------------
    Description: 
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)
	at nl.technolution.ftp.client.VfsFtpTransferClient.test(VfsFtpTransferClient.java:487)
	at nl.technolution.ftp.client.VfsFtpTransferClient.main(VfsFtpTransferClient.java:464)
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


  was:
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)
	at nl.technolution.ftp.client.VfsFtpTransferClient.test(VfsFtpTransferClient.java:487)
	at nl.technolution.ftp.client.VfsFtpTransferClient.main(VfsFtpTransferClient.java:464)
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





I encounter the following problems with hidden directories on FTP.
- The type is IMAGINARY
- The exists() method returns false


> 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)
> 	at nl.technolution.ftp.client.VfsFtpTransferClient.test(VfsFtpTransferClient.java:487)
> 	at nl.technolution.ftp.client.VfsFtpTransferClient.main(VfsFtpTransferClient.java:464)
> 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)