commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeroen Douwes (JIRA)" <>
Subject [jira] [Created] (VFS-573) hidden directory on FTP handled incorrectly
Date Mon, 22 Jun 2015 12:37:00 GMT
Jeroen Douwes created VFS-573:

             Summary: hidden directory on FTP handled incorrectly
                 Key: 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()

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
	at org.apache.commons.vfs2.provider.AbstractFileObject.createFolder(
	at org.apache.commons.vfs2.provider.AbstractFileObject.getOutputStream(
	at org.apache.commons.vfs2.provider.DefaultFileContent.getOutputStream(
	at org.apache.commons.vfs2.provider.DefaultFileContent.getOutputStream(
	at nl.technolution.ftp.client.VfsFtpTransferClient.test(
	at nl.technolution.ftp.client.VfsFtpTransferClient.main(
Caused by: org.apache.commons.vfs2.FileSystemException: Could not create FTP directory "ftp://localhost/hiddenmap".
	at org.apache.commons.vfs2.provider.ftp.FtpFileObject.doCreateFolder(
	at org.apache.commons.vfs2.provider.AbstractFileObject.createFolder(
	... 5 more

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

This message was sent by Atlassian JIRA

View raw message