camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r931489 - /camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java
Date Wed, 07 Apr 2010 10:15:59 GMT
Author: davsclaus
Date: Wed Apr  7 10:15:59 2010
New Revision: 931489

URL: http://svn.apache.org/viewvc?rev=931489&view=rev
Log:
Added more TRACE logging to FileConsumer to aid with issues on various platforms

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java?rev=931489&r1=931488&r2=931489&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java
Wed Apr  7 10:15:59 2010
@@ -36,8 +36,11 @@ public class FileConsumer extends Generi
     }
 
     protected void pollDirectory(String fileName, List<GenericFile<File>> fileList)
{
-        File directory = new File(fileName);
+        if (log.isTraceEnabled()) {
+            log.trace("pollDirectory from fileName: " + fileName);
+        }
 
+        File directory = new File(fileName);
         if (!directory.exists() || !directory.isDirectory()) {
             if (log.isDebugEnabled()) {
                 log.debug("Cannot poll as directory does not exists or its not a directory:
" + directory);
@@ -49,12 +52,26 @@ public class FileConsumer extends Generi
             log.trace("Polling directory: " + directory.getPath());
         }
         File[] files = directory.listFiles();
-
         if (files == null || files.length == 0) {
             // no files in this directory to poll
+            if (log.isTraceEnabled()) {
+                log.trace("No files found in directory: " + directory.getPath());
+            }
             return;
+        } else {
+            // we found some files
+            if (log.isTraceEnabled()) {
+                log.trace("Found " + files.length + " in directory: " + directory.getPath());
+            }
         }
+
         for (File file : files) {
+            // trace log as Windows/Unix can have different views what the file is?
+            if (log.isTraceEnabled()) {
+                log.trace("Found file: " + file + " [isAbsolute: " + file.isAbsolute() +
", isDirectory: "
+                        + file.isDirectory() + ", isFile: " + file.isFile() + ", isHidden:
" + file.isHidden() + "]");
+            }
+
             // creates a generic file
             GenericFile<File> gf = asGenericFile(endpointPath, file);
 
@@ -72,6 +89,9 @@ public class FileConsumer extends Generi
                             log.trace("Skipping as file is already in progress: " + gf.getFileName());
                         }
                     } else {
+                        if (log.isTraceEnabled()) {
+                            log.trace("Adding valid file: " + file);
+                        }
                         // matched file so add
                         fileList.add(gf);
                     }



Mime
View raw message