Author: hadrian
Date: Thu Jul 17 09:57:00 2008
New Revision: 677636

URL: http://svn.apache.org/viewvc?rev=677636&view=rev
Log:
CAMEL-734.  Patch applied with thanks!

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

Modified: 
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java?rev=677636&r1=677635&r2=677636&view=diff
==============================================================================
--- 
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java
 (original)
+++ 
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java
 Thu Jul 17 09:57:00 2008
@@ -75,8 +75,11 @@
             if (endpoint.getConfiguration().isDirectory()) {
                 pollDirectory(fileName);
             } else {
-                client.changeWorkingDirectory(fileName.substring(0, 
fileName.lastIndexOf('/')));
-                final FTPFile[] files = 
client.listFiles(fileName.substring(fileName.lastIndexOf('/') + 1));
+                int index = fileName.lastIndexOf('/');
+                if (index > -1) {
+                    client.changeWorkingDirectory(fileName.substring(0, 
index));
+                }
+                final FTPFile[] files = 
client.listFiles(fileName.substring(index + 1));
                 pollFile(files[0]);
             }
             lastPollTime = System.currentTimeMillis();


Reply via email to