camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mikael Jørgensen (JIRA) <>
Subject [jira] Commented: (CAMEL-3595) FTP rename fails
Date Mon, 31 Jan 2011 10:53:11 GMT


Mikael Jørgensen commented on CAMEL-3595:

I made the following small test case:

    public void testNlstWin() throws Exception {
        FTPClient ftpClient = new FTPClient();
        ftpClient.connect("xxx", 21);
        ftpClient.login("yyy", "zzz");
        String[] names = ftpClient.listNames("test/rename");
        for (String existing : names) {

The strange thing is, that I get the same result from both windows and unix (runing the test
of a windows machine:


UNIX Type: L8 Version: BSD-44

I.e. both of them contains the directory as part of the returned filename - which I hadn't

It might be, that we have only seen the problem on windows servers because this has been the
only place where we transfer multiple files to the same destination-name. 

> FTP rename fails
> ----------------
>                 Key: CAMEL-3595
>                 URL:
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-ftp
>    Affects Versions: 2.4.0
>            Reporter: Mikael Jørgensen
>            Assignee: Claus Ibsen
>             Fix For: 2.7.0
>         Attachments: camel-ftp-patch.txt
> (This is related to the user group discussion
> When using a tmpPrefix when uploading, the rename from the tmp-file to the destination
file fails, if the destination file is already present, even though the option fileExist=Override
is used.
> We have the problem on just a few destination servers which all seems to be windows machines(?).
> I have fetched the 2.4 branch of camel-ftp to find out why it does not work, since the
unit test you refer to in your previous post do excercise the problem.
> It appears that the cause of the problem is, that the FtpOperations.existsFile fails
to return true, which then causes the code not to enter the part where it deletes the exisiting
> The reason for the FtpOperations.existsFile to return false, is, that the list of existing
files has the directoryname prepended, e.g. I'm trying to upload Test.REN to folder test/rename,
and in the code 
> "if (existing.equals(onlyName))" 
> existing=test/rename\Test.REN and onlyName=Test.REN - which returns false - but causes
the later rename to fail as the target folder did contain the Test.REN. 
> My guess is that it is server dependent whether the returned list of names in the directory
include the directory name or not?
> To fix this I have added the following line of code before the if-statement
> existing = FileUtil.stripPath(FileUtil.normalizePath(existing));
> So it will strip the path part of the file name before comparing it to onlyName.

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message