camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r752406 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/component/file/ components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/ components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/
Date Wed, 11 Mar 2009 08:42:46 GMT
Author: ningjiang
Date: Wed Mar 11 08:42:46 2009
New Revision: 752406

URL: http://svn.apache.org/viewvc?rev=752406&view=rev
Log:
Fixed the FromFtpMoveFileAbsoluteFolderRecursiveTest error on Windows box

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFile.java
    camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFile.java
    camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/PaddyRouteTest.java

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=752406&r1=752405&r2=752406&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 08:42:46 2009
@@ -78,7 +78,12 @@
         result.setBinding(source.getBinding());
         return result;
     }
-
+    
+    protected boolean isAbsolute(String name) {
+        File file = new File(name);
+        return file.isAbsolute();        
+    }
+   
     /**
      * Changes the name of this remote file. This method alters the absolute and
      * relative names as well.
@@ -88,12 +93,9 @@
     public void changeFileName(String newName) {
         if (LOG.isTraceEnabled()) {
             LOG.trace("Changing name to: " + newName);
-        }
-
-        // use java.io.File to help us with computing name changes
-        File file = new File(newName);
-        boolean absolute = file.isAbsolute();
-
+        }       
+        
+        File file = new File(newName);            
         if (!absolute) {
             // for relative then we should avoid having the endpoint path duplicated so clip
it
             if (ObjectHelper.isNotEmpty(endpointPath) && newName.startsWith(endpointPath))
{
@@ -117,9 +119,9 @@
         }
 
         // absolute path
-        if (absolute) {
+        if (isAbsolute(newName)) {
             setAbsolute(true);
-            setAbsoluteFilePath(file.getAbsolutePath());
+            setAbsoluteFilePath(newName);
         } else {
             setAbsolute(false);
             // construct a pseudo absolute filename that the file operations uses even for
relative only

Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFile.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFile.java?rev=752406&r1=752405&r2=752406&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFile.java
(original)
+++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFile.java
Wed Mar 11 08:42:46 2009
@@ -17,8 +17,8 @@
 package org.apache.camel.component.file.remote;
 
 import org.apache.camel.component.file.GenericFile;
-import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.FileUtil;
+import org.apache.camel.util.ObjectHelper;
 
 /**
  * Represents a remote file of some sort of backing object
@@ -37,11 +37,17 @@
         this.hostname = hostname;
     }
     
+    @Override
     public char getFileSeparator() {
         // always use / as separator for FTP
         return '/';
     }
-
+    
+    @Override
+    protected boolean isAbsolute(String name) {
+        return name.startsWith("" + getFileSeparator());
+    }
+    
     @SuppressWarnings("unchecked")
     public RemoteFile<T> copyFrom(RemoteFile<T> source) {
         RemoteFile<T> result;

Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/PaddyRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/PaddyRouteTest.java?rev=752406&r1=752405&r2=752406&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/PaddyRouteTest.java
(original)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/PaddyRouteTest.java
Wed Mar 11 08:42:46 2009
@@ -18,9 +18,9 @@
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
-import org.apache.camel.processor.interceptor.Tracer;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.processor.interceptor.Tracer;
 
 /**
  * An unit test based on Paddy having trouble with SFTP.



Mime
View raw message