You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by lh...@apache.org on 2008/12/10 20:13:54 UTC

svn commit: r725387 - /servicemix/smx3/tags/servicemix-3.2.3/deployables/bindingcomponents/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpPollerEndpoint.java

Author: lhein
Date: Wed Dec 10 11:13:54 2008
New Revision: 725387

URL: http://svn.apache.org/viewvc?rev=725387&view=rev
Log:
reverted previous commit

Modified:
    servicemix/smx3/tags/servicemix-3.2.3/deployables/bindingcomponents/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpPollerEndpoint.java

Modified: servicemix/smx3/tags/servicemix-3.2.3/deployables/bindingcomponents/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpPollerEndpoint.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/tags/servicemix-3.2.3/deployables/bindingcomponents/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpPollerEndpoint.java?rev=725387&r1=725386&r2=725387&view=diff
==============================================================================
--- servicemix/smx3/tags/servicemix-3.2.3/deployables/bindingcomponents/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpPollerEndpoint.java (original)
+++ servicemix/smx3/tags/servicemix-3.2.3/deployables/bindingcomponents/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpPollerEndpoint.java Wed Dec 10 11:13:54 2008
@@ -272,7 +272,7 @@
             }
         });
     }
-    
+
     protected boolean processFileAndDelete(String file) {
         FTPClient ftp = null;
         boolean unlock = true;
@@ -281,7 +281,7 @@
             if (logger.isDebugEnabled()) {
                 logger.debug("Processing file " + file);
             }
-            if (isFileExistingOnServer(ftp, file)) {
+            if (ftp.listFiles(file).length > 0) {
                 // Process the file. If processing fails, an exception should be thrown.
                 processFile(ftp, file);
                 // Processing is successful
@@ -305,36 +305,6 @@
         return unlock;
     }
 
-    /**
-     * checks if file specified exists on server
-     * 
-     * @param ftp       the ftp client
-     * @param file      the full file path
-     * @return          true if found on server
-     */
-    private boolean isFileExistingOnServer(FTPClient ftp, String file) throws IOException {
-        boolean foundFile = false;
-        int lastIndex = file.lastIndexOf("/");
-        String directory = ".";
-        String rawName = file;
-        if (lastIndex > 0) { 
-            directory = file.substring(0, lastIndex);
-            rawName = file.substring(lastIndex + 1);
-        }
-
-        FTPFile[] files = listFiles(ftp, directory);
-        if (files.length > 0) {
-            for (FTPFile f : files) {
-                if (f.getName().equals(rawName)) {
-                    foundFile = true;
-                    break;
-                }
-            }
-        }
-
-        return foundFile;
-    }
-    
     protected void processFile(FTPClient ftp, String file) throws Exception {
         InputStream in = ftp.retrieveFileStream(file);
         InOnly exchange = getExchangeFactory().createInOnlyExchange();