You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2010/12/06 10:06:31 UTC
svn commit: r1042552 - in
/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote:
FtpOperations.java SftpOperations.java
Author: davsclaus
Date: Mon Dec 6 09:06:31 2010
New Revision: 1042552
URL: http://svn.apache.org/viewvc?rev=1042552&view=rev
Log:
MR-385: Fixed ftp producer creating directory using windows path. It should normalize the path.
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=1042552&r1=1042551&r2=1042552&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 Dec 6 09:06:31 2010
@@ -237,6 +237,9 @@ public class FtpOperations implements Re
}
public boolean buildDirectory(String directory, boolean absolute) throws GenericFileOperationFailedException {
+ // must normalize directory first
+ directory = endpoint.getConfiguration().normalizePath(directory);
+
if (log.isTraceEnabled()) {
log.trace("buildDirectory(" + directory + ")");
}
@@ -689,10 +692,11 @@ public class FtpOperations implements Re
boolean success = false;
for (String dir : dirs) {
sb.append(dir).append('/');
- String directory = sb.toString();
+ // must normalize the directory name
+ String directory = endpoint.getConfiguration().normalizePath(sb.toString());
- // do not try to build root / folder
- if (!directory.equals("/")) {
+ // do not try to build root folder (/ or \)
+ if (!(directory.equals("/") || directory.equals("\\"))) {
if (log.isTraceEnabled()) {
log.trace("Trying to build remote directory by chunk: " + directory);
}
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=1042552&r1=1042551&r2=1042552&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 Dec 6 09:06:31 2010
@@ -267,6 +267,9 @@ public class SftpOperations implements R
}
public boolean buildDirectory(String directory, boolean absolute) throws GenericFileOperationFailedException {
+ // must normalize directory first
+ directory = endpoint.getConfiguration().normalizePath(directory);
+
if (LOG.isTraceEnabled()) {
LOG.trace("buildDirectory(" + directory + "," + absolute + ")");
}
@@ -318,14 +321,16 @@ public class SftpOperations implements R
boolean success = false;
for (String dir : dirs) {
sb.append(dir).append('/');
- String directory = sb.toString();
- if (LOG.isTraceEnabled()) {
- LOG.trace("Trying to build remote directory by chunk: " + directory);
- }
+ // must normalize the directory name
+ String directory = endpoint.getConfiguration().normalizePath(sb.toString());
- // do not try to build root / folder
- if (!directory.equals("/")) {
+ // do not try to build root folder (/ or \)
+ if (!(directory.equals("/") || directory.equals("\\"))) {
try {
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Trying to build remote directory by chunk: " + directory);
+ }
+
channel.mkdir(directory);
success = true;
} catch (SftpException e) {