camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rbogdanoff <>
Subject FTP Move fails - have found cause but don't understands why
Date Wed, 05 Mar 2014 20:15:33 GMT

I am used camel 2.12.3

I am using an FTP consumer.

There is a file in /mydir/mydir2 named but the move fails.  I
debugged the code and found the cause.

In org.apache.camel.component.file.remote at line 255 the rename is executed

    public boolean renameFile(String from, String to) throws
GenericFileOperationFailedException {
        log.debug("Renaming file: {} to: {}", from, to);
        try {
            *return client.rename(from, to);*
        } catch (IOException e) {
            throw new
client.getReplyString(), e.getMessage(), e);

the from is /mydir/mydir2/ and the to is /mydir/mydir2/.done/

the 'client' in line 255 is is version 3.3 (as per the camel pom)

That code line 2557 looks like

    public boolean rename(String from, String to) throws IOException
        *if (!FTPReply.isPositiveIntermediate(rnfr(from))) {
            return false;*

        return FTPReply.isPositiveCompletion(rnto(to));

So, FTPClient does the rename in two steps - rnfr and rnto.

when rnfr executes it send "RNFR /mydir/mydir2/" to the ftp server.

The ftp server response back with the reply "250 Directory successfully

so rnft(from), which return an int, with return 250.   

However the code in isPositiveIntermediate looks like this...

    public static boolean isPositiveIntermediate(int reply)
        return (reply >= 300 && reply < 400);

so, the return code from "250 Directory successfully changed." will return
false as it is not between 300 and 399 and the seconds step for the rename
rnto(to) never executes and *false*is returned to camel which then thrown a

It seems to me that the reply from the ftp server of "250 Directory
successfully changed." should be OK for the RNFR step of  

I have to believe others have run into this?

Any advise?

Ron Bogdanoff

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message