Repository: camel
Updated Branches:
  refs/heads/json-simple 3f0bc8e40 -> 9959fa5ba


CAMEL-11754: Fixed test on unix and ensure it was using boht windows and unix 
path separators


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9959fa5b
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9959fa5b
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9959fa5b

Branch: refs/heads/json-simple
Commit: 9959fa5ba00e84a29c03fddd7094d9227500bbc2
Parents: 3f0bc8e
Author: Claus Ibsen <davscl...@apache.org>
Authored: Sun Sep 24 19:13:03 2017 +0200
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Sun Sep 24 19:13:03 2017 +0200

----------------------------------------------------------------------
 .../camel/component/file/remote/FtpUtils.java       |  2 +-
 .../FtpUtilsExtractDirNameFromAbsolutePathTest.java | 16 ++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/9959fa5b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpUtils.java
----------------------------------------------------------------------
diff --git 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpUtils.java
 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpUtils.java
index e72e1e7..23ff274 100644
--- 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpUtils.java
+++ 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpUtils.java
@@ -39,7 +39,7 @@ public final class FtpUtils {
     public static String extractDirNameFromAbsolutePath(String path) {
         // default is unix so try with '/'
         // otherwise force File.separator
-        if (path.endsWith("/") || path.endsWith(File.separator)) {
+        if (path.endsWith("/") || path.endsWith("\\")) {
             path = path.substring(0, path.length() - 1);
         }
         return FileUtil.stripPath(path);

http://git-wip-us.apache.org/repos/asf/camel/blob/9959fa5b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpUtilsExtractDirNameFromAbsolutePathTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpUtilsExtractDirNameFromAbsolutePathTest.java
 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpUtilsExtractDirNameFromAbsolutePathTest.java
index ec5d583..10a9a7f 100644
--- 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpUtilsExtractDirNameFromAbsolutePathTest.java
+++ 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpUtilsExtractDirNameFromAbsolutePathTest.java
@@ -23,10 +23,10 @@ public class FtpUtilsExtractDirNameFromAbsolutePathTest {
 
     @Test
     public void testExtractDirNameFromAbsolutePath() {
-        String path = "/test/depth1";
-        assertEquals("depth1", FtpUtils.extractDirNameFromAbsolutePath(path));
-        path = "/test/depth1/";
-        assertEquals("depth1", FtpUtils.extractDirNameFromAbsolutePath(path));
+        String path = "/test/depth1/myfile.txt";
+        assertEquals("myfile.txt", 
FtpUtils.extractDirNameFromAbsolutePath(path));
+        path = "/test/depth1/myfile.txt/";
+        assertEquals("myfile.txt", 
FtpUtils.extractDirNameFromAbsolutePath(path));
         path = "test/depth1/";
         assertEquals("depth1", FtpUtils.extractDirNameFromAbsolutePath(path));
         path = "test/depth1";
@@ -34,10 +34,10 @@ public class FtpUtilsExtractDirNameFromAbsolutePathTest {
         path = "depth1";
         assertEquals("depth1", FtpUtils.extractDirNameFromAbsolutePath(path));
 
-        path = "C:\\test\\depth1";
-        assertEquals("depth1", FtpUtils.extractDirNameFromAbsolutePath(path));
-        path = "C:\\test\\depth1\\";
-        assertEquals("depth1", FtpUtils.extractDirNameFromAbsolutePath(path));
+        path = "\\test\\depth1\\myfile.txt";
+        assertEquals("myfile.txt", 
FtpUtils.extractDirNameFromAbsolutePath(path));
+        path = "\\test\\depth1\\myfile.txt\\";
+        assertEquals("myfile.txt", 
FtpUtils.extractDirNameFromAbsolutePath(path));
         path = "test\\depth1\\";
         assertEquals("depth1", FtpUtils.extractDirNameFromAbsolutePath(path));
         path = "test\\depth1";

Reply via email to