Claus Ibsen created CAMEL-25973:
-----------------------------------
Summary: camel-language - binary=true with a file: or classpath:
script gives the text of the script and leaks the stream
Key: CAMEL-25973
URL: https://issues.apache.org/jira/browse/CAMEL-25973
Project: Camel
Issue Type: Bug
Components: camel-language
Affects Versions: 4.18.0, 4.22.0, 4.23.0
Reporter: Claus Ibsen
Fix For: 4.24.0
With binary=true, the language component returns the content of a script
resource as a stream only for a script with the {{resource:}} prefix. For a
script with a scheme but no prefix, such as
{{language:constant:classpath:data.bin?binary=true}} or {{file:}},
{{LanguageProducer}} opens the resource (main e6885df7894d, line 85), does not
read it because of binary (line 91), and then evaluates the literal text of the
script. The body is the text of the uri, such as "file:/path/data.bin", and the
opened stream is never closed.
Checked on 4.24.0-SNAPSHOT with {{camel run}}:
* {{language:constant:resource:file:bin.dat?binary=true}} gives the content as
a stream;
* {{language:constant:file:bin.dat?binary=true}} gives the String
"file:/.../bin.dat".
*Proposed change*: return the opened stream as the result with binary=true, as
for a {{resource:}} script.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)