Resolution: Not a Problem
Affects Version/s: 2.10.4
Fix Version/s: None
Windows 7 with Oracle Java 6 JDK
Remote vsftpd server on a Redhat based Linux distribution
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.
- 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();
[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!
path = FileUtil.compactPath(path);
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.
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