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

Windows network UNC paths not treated correctly (File2/tempPrefix)

    XMLWordPrintableJSON

Details

    • Patch Available
    • Unknown
    • Patch

    Description

      Dear all,

      We are using Camel's File2 endpoint to deliver reports to a Windows network share. The used URI is (here in a properties file):

      # File URI equivalent of \\FILESERVER.mycompany.local\Public\reports
      report.delivery.to=file:////FILESERVER.mycompany.local/Public/reports?keepLastModified=true&tempPrefix=tmp_

      This results in an exception, see the stack trace (attached).

      I debugged and traced the issue back to:

      org.apache.camel.component.file.GenericFileProducer#createTempFileName

      which is using

      org.apache.camel.util.FileUtil#compactPath(java.lang.String, java.lang.String)

      This method only preserves the first slash/backslash at the start. For UNC paths on Windows however, 2 backslashes are needed.

      I prepared a patch for:

      • org.apache.camel.util.FileUtil
      • org.apache.camel.util.FileUtilTest

      which remedies the issue on Windows.

      I would appreciate if you could check the patch, and integrate it to 2.x and 3.x branches if it is ok.

      Thank you.

      Kind regards,

      Clemens

       

      Attachments

        1. Windows_network_UNC_paths_not_treated_correctly_(File2_tempPrefix).patch
          5 kB
          Clemens Blamauer
        2. stacktrace.log
          4 kB
          Clemens Blamauer

        Activity

          People

            acosentino Andrea Cosentino
            cblamauer Clemens Blamauer
            Votes:
            0 Vote for this issue
            Watchers:
            4 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