Repository: camel
Updated Branches:
  refs/heads/master 712b33524 -> fa4cdd2ac


CAMEL-7865 - Create HashSet only if ExtendedAttributes have been defined


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/fa4cdd2a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/fa4cdd2a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/fa4cdd2a

Branch: refs/heads/master
Commit: fa4cdd2ac7f0ab0507b680fd14822a343933057c
Parents: 64577e5
Author: lburgazzoli <lburgazz...@gmail.com>
Authored: Mon Jan 25 12:07:08 2016 +0100
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Mon Jan 25 13:55:17 2016 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/camel/component/file/FileConsumer.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/fa4cdd2a/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java 
b/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java
index f26d5a1..16c5cd2 100644
--- a/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java
+++ b/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java
@@ -42,9 +42,10 @@ public class FileConsumer extends GenericFileConsumer<File> {
     public FileConsumer(GenericFileEndpoint<File> endpoint, Processor 
processor, GenericFileOperations<File> operations) {
         super(endpoint, processor, operations);
         this.endpointPath = endpoint.getConfiguration().getDirectory();
-        this.extendedAttributes = new HashSet<>();
 
         if (endpoint.getExtendedAttributes() != null) {
+            this.extendedAttributes = new HashSet<>();
+
             for (String attribute : 
endpoint.getExtendedAttributes().split(",")) {
                 extendedAttributes.add(attribute);
             }
@@ -111,7 +112,7 @@ public class FileConsumer extends GenericFileConsumer<File> 
{
                 if (depth >= endpoint.minDepth && isValidFile(gf, false, 
files)) {
                     log.trace("Adding valid file: {}", file);
                     // matched file so add
-                    if (!extendedAttributes.isEmpty()) {
+                    if (extendedAttributes != null) {
                         Path path = file.toPath();
                         Map<String, Object> allAttributes = new HashMap<>();
                         for (String attribute : extendedAttributes) {

Reply via email to