Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-15971

SimpleFileLanguage always null due to DummyExchange

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.23.2
    • Fix Version/s: 3.7.1, 2.25.4, 3.8.0
    • Component/s: came-core
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

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

              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");
              }
      

      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.

        Attachments

        1. camelftp.tgz
          3 kB
          Kurt Stam

          Issue Links

            Activity

              People

              • Assignee:
                davsclaus Claus Ibsen
                Reporter:
                kstam Kurt Stam
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: