You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Rastislav Papp (Jira)" <ji...@apache.org> on 2021/06/11 06:50:00 UTC

[jira] [Updated] (CAMEL-16709) camel resource handling of windows file uri

     [ https://issues.apache.org/jira/browse/CAMEL-16709?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rastislav Papp updated CAMEL-16709:
-----------------------------------
    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:

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

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:
{code:java}
Path path = Paths.get(URI.create("file:/C:/test.txt"));
{code}
(and we use something like this in multiple places)

  was:
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:

{code:java}
org.apache.camel.support.ResourceHelper#resolveMandatoryResourceAsInputStream(context, "file:/C:/test.txt");
{code}

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:
{code:java}
Path path = Paths.get(URI.create("file:/C:/test.txt"));
{code}
(and we use something like this in multiple places)


> camel resource handling of windows file uri
> -------------------------------------------
>
>                 Key: CAMEL-16709
>                 URL: https://issues.apache.org/jira/browse/CAMEL-16709
>             Project: Camel
>          Issue Type: Bug
>          Components: came-core
>    Affects Versions: 3.10.0
>            Reporter: Rastislav Papp
>            Priority: Critical
>
> 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:
> {code:java}
> org.apache.camel.support.ResourceHelper.resolveMandatoryResourceAsInputStream(context, "file:/C:/test.txt");
> {code}
> 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:
> {code:java}
> Path path = Paths.get(URI.create("file:/C:/test.txt"));
> {code}
> (and we use something like this in multiple places)



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