Return-Path: Delivered-To: apmail-camel-commits-archive@www.apache.org Received: (qmail 45334 invoked from network); 11 Mar 2009 10:46:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Mar 2009 10:46:27 -0000 Received: (qmail 57326 invoked by uid 500); 11 Mar 2009 10:46:26 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 57288 invoked by uid 500); 11 Mar 2009 10:46:25 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 56982 invoked by uid 99); 11 Mar 2009 10:46:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Mar 2009 03:46:21 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Mar 2009 10:46:18 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id A96E22388920; Wed, 11 Mar 2009 10:45:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r752421 - in /camel/trunk/camel-core/src/main/java/org/apache/camel/component/file: FileOperations.java GenericFile.java Date: Wed, 11 Mar 2009 10:45:56 -0000 To: commits@camel.apache.org From: ningjiang@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090311104556.A96E22388920@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ningjiang Date: Wed Mar 11 10:45:56 2009 New Revision: 752421 URL: http://svn.apache.org/viewvc?rev=752421&view=rev Log: Fixed the unitest error of MoveFilesToDirectoryTest Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFile.java Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java?rev=752421&r1=752420&r2=752421&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java Wed Mar 11 10:45:56 2009 @@ -60,6 +60,7 @@ public boolean renameFile(String from, String to) throws GenericFileOperationFailedException { File file = new File(from); File target = new File(to); + //System.out.println("rename the file from " + from + " to " + to); return file.renameTo(target); } Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFile.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFile.java?rev=752421&r1=752420&r2=752421&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFile.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFile.java Wed Mar 11 10:45:56 2009 @@ -19,6 +19,7 @@ import java.io.File; import java.io.Serializable; +import org.apache.camel.util.FileUtil; import org.apache.camel.util.ObjectHelper; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -93,17 +94,20 @@ public void changeFileName(String newName) { if (LOG.isTraceEnabled()) { LOG.trace("Changing name to: " + newName); - } - - File file = new File(newName); + } + // Make sure the newName is normalized. + String newFileName = FileUtil.normalizePath(newName); + File file = new File(newFileName); if (!absolute) { // for relative then we should avoid having the endpoint path duplicated so clip it - if (ObjectHelper.isNotEmpty(endpointPath) && newName.startsWith(endpointPath)) { + System.out.println("endpointPath " + endpointPath); + System.out.println("newName " + newFileName); + if (ObjectHelper.isNotEmpty(endpointPath) && newFileName.startsWith(endpointPath)) { // clip starting endpoint in case it was added - newName = ObjectHelper.after(newName, endpointPath + getFileSeparator()); + newFileName = ObjectHelper.after(newFileName, endpointPath + getFileSeparator()); // reconstruct file with clipped name - file = new File(newName); + file = new File(newFileName); } } @@ -119,9 +123,9 @@ } // absolute path - if (isAbsolute(newName)) { + if (isAbsolute(newFileName)) { setAbsolute(true); - setAbsoluteFilePath(newName); + setAbsoluteFilePath(newFileName); } else { setAbsolute(false); // construct a pseudo absolute filename that the file operations uses even for relative only