I've committed the fix, thx.
Btw, i moved the test up in the loop, so that
"." and ".." are checked first, before checking
the file type.

On 10/31/06, abrighton <[EMAIL PROTECTED]> wrote:

I corrected the patch for the ftp polling component
(The check for "." and ".." was in the wrong place - sorry).

--
Allan


abrighton wrote:
>
>
> Here is a (corrected) patch for the recursion problem:
>  http://www.nabble.com/file/3917/FtpPollingEndpoint.patch
> FtpPollingEndpoint.patch
>
> Here is the changed method:
>
>      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();
>             File f = new File(file);
>             if (files[i].isFile()) {
>                 if (getFilter() == null || getFilter().accept(f)) {
>                     pollFile(file); // process the file
>                 }
>             } else {
>                 if (processDir && files[i].isDirectory()) {
>                     String name = f.getName();
>                     if (name.equals(".") || name.equals("..")) {
>                         continue; // ignore "." and ".."
>                     }
>                     logger.debug("Polling directory " + file);
>                     pollFileOrDirectory(ftp, file, isRecursive());
>                 } else {
>                     logger.debug("Skipping directory " + file);
>                 }
>             }
>         }
>     }
>
>

--
View this message in context: 
http://www.nabble.com/servicemix-ftp%3A-FtpPollingEndpoint--tf2540539.html#a7089699
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.




--
Cheers,
Guillaume Nodet

Reply via email to