Claus Ibsen created CAMEL-24996:
-----------------------------------
Summary: camel-core - Changing a header value through the entry
set of a copied message changes the original message
Key: CAMEL-24996
URL: https://issues.apache.org/jira/browse/CAMEL-24996
Project: Camel
Issue Type: Bug
Components: camel-core
Affects Versions: 4.21.0, 4.22.0
Reporter: Claus Ibsen
Changing a header value through the entry set of a copied message changes the
header of the original message, and of the other copies.
Since CAMEL-23681 (Camel 4.21), a copied message shares its headers with the
original through CopyOnWriteHeadersMap until one of them changes a header. The
entry set of a shared map returned the entries of the shared map itself (from
its iterator and from toArray). So entry.setValue(...) changed the shared map
without copying it first.
For example, in a split each sub-message starts out sharing the headers of the
parent message. A sub-message that changes a header value through
getHeaders().entrySet() changed it for the parent message and for the other
sub-messages. After the split, the parent message had the value set by the last
sub-message.
The entries of a shared map are now wrapped, so setValue copies the map first,
as the other write operations already do.
Affects 4.21.0 and 4.22.0.
_Claude Code on behalf of Claus Ibsen_
--
This message was sent by Atlassian Jira
(v8.20.10#820010)