camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject svn commit: r999770 - /camel/trunk/camel-core/src/main/java/org/apache/camel/util/FileUtil.java
Date Wed, 22 Sep 2010 06:21:29 GMT
Author: hadrian
Date: Wed Sep 22 06:21:29 2010
New Revision: 999770

URL: http://svn.apache.org/viewvc?rev=999770&view=rev
Log:
CAMEL-3144. Patch applied with thanks to Raphael

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/util/FileUtil.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/FileUtil.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/FileUtil.java?rev=999770&r1=999769&r2=999770&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/util/FileUtil.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/FileUtil.java Wed Sep 22 06:21:29
2010
@@ -151,12 +151,15 @@ public final class FileUtil {
             return null;
         }
         int pos = name.lastIndexOf('/');
-        if (pos == -1) {
-            pos = name.lastIndexOf(File.separator);
-        }
-        if (pos != -1) {
+        if (pos > 0) {
             return name.substring(0, pos);
+        } else if (pos == 0) {
+            // name is actually the root path
+            return name;
+        } else {
+            pos = name.lastIndexOf(File.separator);
         }
+
         // no path
         return null;
     }



Mime
View raw message