You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2024/02/16 11:07:00 UTC

[jira] [Updated] (CAMEL-20429) setBody clears/invalidates streamcache still being used in header/property

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

Claus Ibsen updated CAMEL-20429:
--------------------------------
    Priority: Minor  (was: Major)

> setBody clears/invalidates streamcache still being used in header/property
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-20429
>                 URL: https://issues.apache.org/jira/browse/CAMEL-20429
>             Project: Camel
>          Issue Type: Bug
>          Components: came-core
>    Affects Versions: 4.0.3
>            Reporter: Rik van Ballegooijen
>            Priority: Minor
>
> While upgrading from camel 3 to 4 we ran into a stream cache related issue. An input stream containing the content of a HTML file is emptied/closed/invalidated after setting the exchange body to something different, even though the input stream is still in use, for example in a header.
> {code:java}
> <setHeader name="CamelThymeleafTemplate">
>     <simple>${exchangeProperty.templateContents}</simple>
> </setHeader>
> <log message="CamelThymeleafTemplate after header set: ${headers.CamelThymeleafTemplate}" />
> <setBody>
>     <exchangeProperty>templateData</exchangeProperty>
> </setBody>
> <log message="CamelThymeleafTemplate before thymeleaf endpoint: ${headers.CamelThymeleafTemplate}" /> {code}
> In the example above the first log statement will print the content of the HTML file, the 2nd log statement will print an empty header. No errors are thrown.
> As a workaround, changing the type to a String fixes the issue:
> {code:java}
> <simple resultType="java.lang.String">${exchangeProperty.templateContents}</simple>{code}
> Is the stream cache discarded too soon? If we are not supposed to use it anymore after resetting the body I would expect an error of some sort rather than an empty result.



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