Pontus Ullgren created CAMEL-7063:
-------------------------------------

             Summary: FTPOperations uses local OS path separator, instead of 
FTP Server in buildDirectory
                 Key: CAMEL-7063
                 URL: https://issues.apache.org/jira/browse/CAMEL-7063
             Project: Camel
          Issue Type: Bug
          Components: camel-ftp
    Affects Versions: 2.12.1
         Environment: Camel 2.12.1
Java JDK 1.6 running on Windows connecting to SFTP and FTP on remote *nix 
systems.
            Reporter: Pontus Ullgren


I have a problem when running a camel route that moves files from a SFTP server 
to a FTP server.
The problem occurs when the camel route executes on Windows while the remote 
servers are *nix.

This log shows the error (hostname, usernames and paths has been changed). As 
you can see FtpOperations#buildDirectory() is called using the local  OS path 
separator.
---
 INFO  [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.RemoteFileProducer]   Connected and 
logged in to: 
Endpoint[ftp://[email protected]//d02/test/in?binary=true&fileName=%24%7Bfile%3Aonlyname%7D&localWorkDirectory=%2Ftmp%2FcamelFileTmp%2F10027&password=xxxxxx&tempFileName=TEMP_%24%7Bfile%3Aonlyname%7D]
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.RemoteFileProducer]   Writing using 
tempNameFile: /d02/test/in/TEMP_PDF20131211001.pdf
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.FtpOperations]   
existsFile(/d02/test/in/PDF20131211001.pdf)
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.FtpOperations]   Existing file: 
/d02/test/in/PDF20131211001.pdf, target file: /d02/test/in/PDF20131211001.pdf
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.RemoteFileProducer]   
EagerDeleteTargetFile, target exists
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.RemoteFileProducer]   Eagerly deleting 
existing file: /d02/test/in/PDF20131211001.pdf
 DEBUG [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.FtpOperations]   Deleting file: 
/d02/test/in/PDF20131211001.pdf
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.FtpOperations]   getCurrentDirectory()
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.FtpOperations]   Current dir: 
/home/user1
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.FtpOperations]   
changeCurrentDirectory(/d02/test/in)
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.FtpOperations]   Changing directory: /
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.FtpOperations]   Changing directory: d02
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.FtpOperations]   Changing directory: 
test
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.FtpOperations]   Changing directory: in
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.FtpOperations]   Client deleteFile: 
PDF20131211001.pdf
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.FtpOperations]   
changeCurrentDirectory(/home/user1)
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.FtpOperations]   Changing directory: /
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.FtpOperations]   Changing directory: 
home
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.FtpOperations]   Changing directory: 
user1
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.FtpOperations]   
existsFile(/d02/test/in/TEMP_PDF20131211001.pdf)
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.FtpOperations]   
buildDirectory(\d02\test\in)
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.FtpOperations]   Trying to build remote 
directory: \d02\test\in
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.FtpOperations]   
changeCurrentDirectory(/home/user1)
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.FtpOperations]   Changing directory: /
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.FtpOperations]   Changing directory: 
home
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.FtpOperations]   Changing directory: 
user1
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.RemoteFileProducer]   About to write 
[/d02/test/in/TEMP_PDF20131211001.pdf] to 
[Endpoint[ftp://[email protected]//d02/test/in?binary=true&fileName=%24%7Bfile%3Aonlyname%7D&localWorkDirectory=%2Ftmp%2FcamelFileTmp%2F10027&password=xxxxxx&tempFileName=TEMP_%24%7Bfile%3Aonlyname%7D]]
 from exchange [Exchange[PDF20131211001.pdf]]
 TRACE [Camel (camel-context) thread #24 - 
sftp://[email protected]/download/PDF] 
[org.apache.camel.component.file.remote.FtpOperations]   
storeFile(/d02/test/in/TEMP_PDF20131211001.pdf)
----
The result is that there is a new folder called "\d02\test\in" in /home/user1 
on the ftp server.

>From a quick analysis of the problem it seems to originate in 
>"GenericFileProducer.java" line 260, where FileUtil.normalizePath will give a 
>path with '\\' since the executing platform is Windows.

One solution might be that FTPOperations fix the path before actually trying to 
build the directory.



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)

Reply via email to