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

camel-file - tempFileName directory is not auto-created if it is relative before the endpoint path

    XMLWordPrintableJSON

    Details

    • Estimated Complexity:
      Unknown

      Description

      Hi,

      I face a requirement to place temp files in a folder at the same hierarchy as the output folder like this:

      • target/data/output/claus.txt
      • target/data/temp/claus.tmp

      Using a simple route definition like:

      from("direct:a").to("file://target/data/output/?tempFileName=../temp/${file:name.noext}.tmp")

       

      If the temp folder does not exist, the GenericFileProducer should auto-create it. However, it only does so correctly for the tempFileName path, if it is relativ "after" the endpoint path. If it is above/before the endpoint path the tempFileName path will be created as a child of the endpoint path instead:

      • target/data/output/target/data/temp

      This results in a NoSuchFileException when camel tries to write the temp file into the "correct" temp directory target/data/temp afterwards.

       

       

      A very easy way to reproduce this is to use the 'parentFileUrl' instead of the 'fileUrl' in the createRouteBuilder method of FileProduceTempFileNameTest.java (https://github.com/apache/camel/blob/master/core/camel-core/src/test/java/org/apache/camel/component/file/FileProduceTempFileNameTest.java).

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              derdimi Dimitri Kotlovsky
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 40m
                40m