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

Bruno Mendola updated CAMEL-17985:
----------------------------------
    Description: 
When trying to load a registry resource as XSLT source, XsltUriResolver uses 
*ResourceHelper* to check the scheme and then load the resource.

{{ResourceHelper.hasScheme(String)}} only supports "file:", "classpath:", 
"http:" and "https:" schemes, so the "ref:" uri fails to validate and is not 
correctly handled (the prefix "classpath:" is automatically appended).

!image-2022-04-19-16-58-23-222.png|width=674,height=176!

The resulting exception when using a "ref:" uri is the following:
{code:java}
javax.xml.transform.TransformerException: java.io.FileNotFoundException: Cannot 
find resource: classpath:ref:camelResource-2 for URI: 
classpath:ref:camelResource-2
        at 
org.apache.camel.component.xslt.XsltUriResolver.resolve(XsltUriResolver.java:92)
        at 
org.apache.camel.component.xslt.XsltUriResolver.resolve(XsltUriResolver.java:100)
        at 
org.apache.camel.component.xslt.XsltEndpoint.loadResource(XsltEndpoint.java:322)
        at 
org.apache.camel.component.xslt.XsltEndpoint.doStart(XsltEndpoint.java:351)
        at 
org.apache.camel.support.service.BaseService.start(BaseService.java:119)
        ... 49 common frames omitted
Caused by: java.io.FileNotFoundException: Cannot find resource: 
classpath:ref:camelResource-2 for URI: classpath:ref:camelResource-2
        at 
org.apache.camel.support.ResourceHelper.resolveMandatoryResourceAsInputStream(ResourceHelper.java:114)
        at 
org.apache.camel.component.xslt.XsltUriResolver.resolve(XsltUriResolver.java:90)
        ... 53 common frames omitted{code}
 

 

  was:
When trying to load a registry resource as XSLT source, XsltUriResolver uses 
*ResourceHelper* to check the scheme and then load the resource.

{{ResourceHelper.hasScheme(String)}} only supports "file:", "classpath:", 
"http:" and "https:" schemes, so the "ref:" uri fails to validate and is not 
correctly handled.

!image-2022-04-19-16-58-23-222.png|width=674,height=176!


> ResourceHelper does not support ref: scheme
> -------------------------------------------
>
>                 Key: CAMEL-17985
>                 URL: https://issues.apache.org/jira/browse/CAMEL-17985
>             Project: Camel
>          Issue Type: Bug
>            Reporter: Bruno Mendola
>            Priority: Major
>         Attachments: image-2022-04-19-16-58-23-222.png
>
>
> When trying to load a registry resource as XSLT source, XsltUriResolver uses 
> *ResourceHelper* to check the scheme and then load the resource.
> {{ResourceHelper.hasScheme(String)}} only supports "file:", "classpath:", 
> "http:" and "https:" schemes, so the "ref:" uri fails to validate and is not 
> correctly handled (the prefix "classpath:" is automatically appended).
> !image-2022-04-19-16-58-23-222.png|width=674,height=176!
> The resulting exception when using a "ref:" uri is the following:
> {code:java}
> javax.xml.transform.TransformerException: java.io.FileNotFoundException: 
> Cannot find resource: classpath:ref:camelResource-2 for URI: 
> classpath:ref:camelResource-2
>       at 
> org.apache.camel.component.xslt.XsltUriResolver.resolve(XsltUriResolver.java:92)
>       at 
> org.apache.camel.component.xslt.XsltUriResolver.resolve(XsltUriResolver.java:100)
>       at 
> org.apache.camel.component.xslt.XsltEndpoint.loadResource(XsltEndpoint.java:322)
>       at 
> org.apache.camel.component.xslt.XsltEndpoint.doStart(XsltEndpoint.java:351)
>       at 
> org.apache.camel.support.service.BaseService.start(BaseService.java:119)
>       ... 49 common frames omitted
> Caused by: java.io.FileNotFoundException: Cannot find resource: 
> classpath:ref:camelResource-2 for URI: classpath:ref:camelResource-2
>       at 
> org.apache.camel.support.ResourceHelper.resolveMandatoryResourceAsInputStream(ResourceHelper.java:114)
>       at 
> org.apache.camel.component.xslt.XsltUriResolver.resolve(XsltUriResolver.java:90)
>       ... 53 common frames omitted{code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to