You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Lu Tahmazyan (JIRA)" <ji...@apache.org> on 2013/05/19 17:53:16 UTC

[jira] [Commented] (CAMEL-6219) FTPOperations changeCurrentDirectory uses local OS path separator, instead of FTP Server. File upload fails.

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

Lu Tahmazyan commented on CAMEL-6219:
-------------------------------------

I am seeing the same error in 2.11.0 Release. 
Running the FTP client example (src/main/java/org/apache/camel/example/ftp/MyFtpClient.java) shipped with 2.11.0.

I am getting 
org.apache.camel.component.file.GenericFileOperationFailedException: File operation failed: 550 Failed to change directory.

FTP server is running Windows Server.
Client is running on Mac Book Pro.  


                
> FTPOperations changeCurrentDirectory uses local OS path separator, instead of FTP Server. File upload fails.
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-6219
>                 URL: https://issues.apache.org/jira/browse/CAMEL-6219
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-ftp
>    Affects Versions: 2.10.4
>         Environment: Windows 7 with Oracle Java 6 JDK
> Remote vsftpd server on a Redhat based Linux distribution
>            Reporter: Mark Richards
>
> Summary:
> When uploading a single file to a vsftpd server from Windows using a Camel ftp:// endpoint results in a 550 Failed to change directory error.
> Likely because the changeCurrentDirectory() command in FTPOperations doesn't provide the server pathSeparator when compacting the url.
> Recreate:
>  - Start a vsftpd server (this likely affects other FTP servers) in a *nix environment.
>  - Set log4j properties to TRACE for Camel
>  - In Windows, run a simple Java class that includes the following
> ProducerTemplate pt = camelContext.createProducerTemplate();
> pt.sendBody("ftp://user@host/subfolder?fileName=test.file&password=12345678&stepwise=false&separator=UNIX");
> Trace:
> [2013.03.27 14:53:56] [main]  TRACE FtpOperations -  buildDirectory(test)
> [2013.03.27 14:53:56] [main]  TRACE FtpOperations -  changeCurrentDirectory(/var/ftp/pub)
> [2013.03.27 14:53:56] [main]  TRACE FtpOperations -  Changing directory: \var\ftp\pub
> [2013.03.27 14:53:56] [main]  WARN  RemoteFileProducer -  Writing file failed with: File operation failed: 550 Failed to change directory.
>  Cannot change directory to: \var\ftp\pub. Code: 550
> As you can see the path swaps from /var/ftp/pub to \var\ftp\pub which is the wrong path separator!
> Likely location:
> org.apache.camel.component.file.remote.FTPOperations:656
>     path = FileUtil.compactPath(path);
> org.apache.camel.util.FileUtil:209
>     return compactPath(path, File.separatorChar);
> File.separatorChar would return the LOCAL OS path, not the REMOTE OS path.
> This should use the value specified by separator=UNIX ("/" not "\").
> Possible fix would be to use the other compactPath(path,separator) method.
> Result:
> You cannot upload a single file using FTP in this fashion from a Windows client to a vsftpd server on Linux. I'll have to switch to an alternative product for ftp until this is resolved, but look forward to returning to using Camel for FTP uploads in the future :)

--
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