servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r469420 - /incubator/servicemix/trunk/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpPollingEndpoint.java
Date Tue, 31 Oct 2006 09:00:47 GMT
Author: gnodet
Date: Tue Oct 31 01:00:46 2006
New Revision: 469420

URL: http://svn.apache.org/viewvc?view=rev&rev=469420
Log:
Fix the check for "." and ".." which are directories and not files

Modified:
    incubator/servicemix/trunk/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpPollingEndpoint.java

Modified: incubator/servicemix/trunk/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpPollingEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpPollingEndpoint.java?view=diff&rev=469420&r1=469419&r2=469420
==============================================================================
--- incubator/servicemix/trunk/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpPollingEndpoint.java
(original)
+++ incubator/servicemix/trunk/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpPollingEndpoint.java
Tue Oct 31 01:00:46 2006
@@ -209,21 +209,26 @@
     protected void pollFileOrDirectory(FTPClient ftp, String fileOrDirectory, boolean processDir)
throws Exception {
         FTPFile[] files = ftp.listFiles(fileOrDirectory);
         for (int i = 0; i < files.length; i++) {
-            String file = fileOrDirectory + "/" + files[i].getName();
+            String name = files[i].getName();
+            if (name.equals(".") || name.equals("..")) {
+                continue; // ignore "." and ".."
+            }
+            String file = fileOrDirectory + "/" + name;
+            // This is a file, process it
             if (!files[i].isDirectory()) {
-                File f = new File(file);
-                String name = f.getName();
-                if (name.equals(".") || name.equals("..")) {
-                    continue; // ignore "." and ".."
-                }
-                if (getFilter() == null || getFilter().accept(f)) {
+                if (getFilter() == null || getFilter().accept(new File(file))) {
                     pollFile(file); // process the file
                 }
+            // Only process directories if processDir is true
             } else if (processDir) {
-                logger.debug("Polling directory " + file);
+                if (logger.isDebugEnabled()) {
+                    logger.debug("Polling directory " + file);
+                }
                 pollFileOrDirectory(ftp, file, isRecursive());
             } else {
-                logger.debug("Skipping directory " + file);
+                if (logger.isDebugEnabled()) {
+                    logger.debug("Skipping directory " + file);
+                }
             }
         }
     }



Mime
View raw message