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

camel-core - camel resource handling of windows file uri problem

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.10.0
    • Fix Version/s: 3.11.0
    • Component/s: came-core
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      In 3.10.0 (maybe sooner, we're trying to switch from 3.6.0) handling of URIs has changed, and this code no longer works:

      org.apache.camel.support.ResourceHelper.resolveMandatoryResourceAsInputStream(context, "file:/C:/test.txt");
      

      because Camel will try to send "/C:/xxx.txt" into Paths.get(...), instead of new FileInputStream(...) as before. Paths.get cannot handle the initial slash.

      Switching to the format without the slash - "file:C:/..." would work, but then following code does not:

      Path path = Paths.get(URI.create("file:C:/test.txt"));
      

      It fails with URI is not hierarchical message (and we use something like this in multiple places, so this stops us from upgrading to newer versions of camel)

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              rastislav.papp Rastislav Papp
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: