Author: davsclaus
Date: Mon Nov  8 08:44:58 2010
New Revision: 1032496

URL: http://svn.apache.org/viewvc?rev=1032496&view=rev
Log:
CAMEL-3309: Fixed sftp producer with change dir stepwise and not stepswise.

Modified:
    
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
    
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java

Modified: 
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java?rev=1032496&r1=1032495&r2=1032496&view=diff
==============================================================================
--- 
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
 (original)
+++ 
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
 Mon Nov  8 08:44:58 2010
@@ -262,7 +262,7 @@ public class FtpOperations implements Re
             } finally {
                 // change back to original directory
                 if (originalDirectory != null) {
-                    client.changeWorkingDirectory(originalDirectory);
+                    changeCurrentDirectory(originalDirectory);
                 }
             }
         } catch (IOException e) {
@@ -510,10 +510,18 @@ public class FtpOperations implements Re
     }
 
     public void changeCurrentDirectory(String path) throws 
GenericFileOperationFailedException {
+        if (log.isTraceEnabled()) {
+            log.trace("changeCurrentDirectory(" + path + ")");
+        }
         if (ObjectHelper.isEmpty(path)) {
             return;
         }
 
+        // not stepwise should change directory in one operation
+        if (!endpoint.getConfiguration().isStepwise()) {
+            doChangeDirectory(path);
+        }
+
         // if it starts with the root path then a little special handling for 
that
         if (FileUtil.hasLeadingSeparator(path)) {
             // change to root path

Modified: 
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java?rev=1032496&r1=1032495&r2=1032496&view=diff
==============================================================================
--- 
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
 (original)
+++ 
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
 Mon Nov  8 08:44:58 2010
@@ -356,6 +356,11 @@ public class SftpOperations implements R
             return;
         }
 
+        // not stepwise should change directory in one operation
+        if (!endpoint.getConfiguration().isStepwise()) {
+            doChangeDirectory(path);
+        }
+
         // if it starts with the root path then a little special handling for 
that
         if (FileUtil.hasLeadingSeparator(path)) {
             // change to root path


Reply via email to