Claus Ibsen created CAMEL-24885:
-----------------------------------

             Summary: camel-core - Simple: a resource: text with a function but 
no scheme ends in a StackOverflowError
                 Key: CAMEL-24885
                 URL: https://issues.apache.org/jira/browse/CAMEL-24885
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 4.22.0
            Reporter: Claus Ibsen
             Fix For: 4.23.0


A Simple expression whose text starts with {{resource:}} and contains a 
function, but names no scheme, ends in a StackOverflowError at evaluation:

{code}
- setBody:
    simple: "resource:templates/${header.type}.json"
{code}

{noformat}
java.lang.StackOverflowError
    at 
org.apache.camel.support.ScriptHelper.resolveOptionalExternalScript(ScriptHelper.java:77)
    at 
org.apache.camel.language.simple.SimpleLanguage$SimpleExpression.evaluate(SimpleLanguage.java:264)
    at 
org.apache.camel.language.simple.SimpleLanguage$SimpleExpression.evaluate(SimpleLanguage.java:267)
    ... (repeats)
{noformat}

{{LanguageSupport.isDynamicResource}} only checks the {{resource:}} prefix and 
a function, so {{SimpleLanguage.createExpression}} returns the lazy 
{{SimpleExpression}}; at evaluation 
{{ScriptHelper.resolveOptionalExternalScript}} requires a scheme 
({{hasExternalScript}}) and returns the text as it is, {{createExpression}} is 
called with the same text and returns the lazy expression again, without end.

Fix: {{isDynamicResource}} uses the same test as the loader 
({{ScriptHelper.hasExternalScript}}) so a scheme-less {{resource:}} text is a 
plain expression, as it is without a function. Found while testing CAMEL-24884.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to