Kurt Stam created CAMEL-15971:
---------------------------------

             Summary: SimpleFileLanguage always null due to DummyExchange
                 Key: CAMEL-15971
                 URL: https://issues.apache.org/jira/browse/CAMEL-15971
             Project: Camel
          Issue Type: Bug
          Components: came-core
    Affects Versions: 2.23.2
            Reporter: Kurt Stam
         Attachments: camelftp.tgz

I'm trying to use the File component to move all *.txt files from the 'source' 
to the 'target' directory. 

{code:java}
        public void configure() throws Exception {
            from("file://source?fileName=%24%7Bfile%3Aonlyname.noext%7D.txt")
                .to("log://org.apache.camel.howto?showAll=true")
                .to("file://target");
        }
{code}

I'm configuring the fileName as ${file:onlyname.noext}.txt. 

https://github.com/apache/camel/blob/camel-2.25.x/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguage.java#L85

However, not any file names match ever because the ${file:onlyname.noext} is 
always null because it's trying to obtain the file name from the exchange which 
is completely empty.

It seems to me that you should not create a DummyExchange:
https://github.com/apache/camel/blob/camel-2.25.x/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java#L701

Please find a demo project attached.







--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to