camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r887291 - /camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java
Date Fri, 04 Dec 2009 17:42:16 GMT
Author: davsclaus
Date: Fri Dec  4 17:42:15 2009
New Revision: 887291

URL: http://svn.apache.org/viewvc?rev=887291&view=rev
Log:
CAMEL-2259: Fixed potential very rare NPE in file consumer that only applies to Camel 1.x

Modified:
    camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java

Modified: camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java?rev=887291&r1=887290&r2=887291&view=diff
==============================================================================
--- camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java
(original)
+++ camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java
Fri Dec  4 17:42:15 2009
@@ -96,6 +96,12 @@
                     LOG.trace("Polling directory " + fileOrDirectory);
                 }
                 File[] files = fileOrDirectory.listFiles();
+
+                if (files == null || files.length == 0) {
+                    // no files in this directory to poll
+                    return rc;
+                }
+
                 for (File file : files) {
                     rc += pollFileOrDirectory(file, isRecursive()); // self-recursion
                 }



Mime
View raw message