camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Richards (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CAMEL-6219) FTPOperations changeCurrentDirectory uses local OS path separator, instead of FTP Server. File upload fails.
Date Wed, 27 Mar 2013 15:05:16 GMT
Mark Richards created CAMEL-6219:
------------------------------------

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

Mime
View raw message