Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8BF8210C8E for ; Wed, 5 Mar 2014 20:16:15 +0000 (UTC) Received: (qmail 9734 invoked by uid 500); 5 Mar 2014 20:16:11 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 9256 invoked by uid 500); 5 Mar 2014 20:16:10 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 9033 invoked by uid 99); 5 Mar 2014 20:16:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Mar 2014 20:16:09 +0000 X-ASF-Spam-Status: No, hits=2.3 required=5.0 tests=SPF_SOFTFAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: softfail (athena.apache.org: transitioning domain of ron.bogdanoff@gmail.com does not designate 216.139.236.26 as permitted sender) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Mar 2014 20:16:05 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1WLIE1-0000vz-8P for users@camel.apache.org; Wed, 05 Mar 2014 12:15:33 -0800 Date: Wed, 5 Mar 2014 12:15:33 -0800 (PST) From: rbogdanoff To: users@camel.apache.org Message-ID: <1394050533254-5748358.post@n5.nabble.com> Subject: FTP Move fails - have found cause but don't understands why MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi, I am used camel 2.12.3 I am using an FTP consumer. ftp.mysite.com/mydir/mydir2?username=abc&password=abc&streamDownload=true&move=.done&delay=600000 There is a file in /mydir/mydir2 named xxx.xxx 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 GenericFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e); } } the from is /mydir/mydir2/xxx.xxx and the to is /mydir/mydir2/.done/xxx.xxx the 'client' in line 255 is org.apache.commons.net.ftp.FTPClient.rename(...) org.apache.commons.net is version 3.3 (as per the camel pom) That code org.apache.commons.net.ftp.FTPClient.rename line 2557 looks like this 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/xxx.xxx" to the ftp server. The ftp server response back with the reply "250 Directory successfully changed." 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 GenericFileOperationFailedException It seems to me that the reply from the ftp server of "250 Directory successfully changed." should be OK for the RNFR step of org.apache.commons.net.ftp.FTPClient.rename. I have to believe others have run into this? Any advise? Regards Ron Bogdanoff -- View this message in context: http://camel.465427.n5.nabble.com/FTP-Move-fails-have-found-cause-but-don-t-understands-why-tp5748358.html Sent from the Camel - Users mailing list archive at Nabble.com.