Skip to content

MessageHeaders mutable through Map.Entry.setValue() [SPR-13385] #17966

@spring-projects-issues

Description

@spring-projects-issues

Andrei Amariei opened SPR-13385 and commented

org.springframework.messaging.MessageHeaders can be modified using Map.Entry.setValue() method like in the following snippet:

Integer value = 123;
Map<String, Object> map = new HashMap<String, Object>();
map.put("test", value);
MessageHeaders headers = new MessageHeaders(map);
headers.entrySet().iterator().next().setValue(124);

Immutability should be achievable using something like in java.util.Collections.UnmodifiableMap.entrySet()

Doesn't seem like a big problem, but it's in contradiction with the documentation of the class which describes it as immutable


Affects: 4.2 GA

Issue Links:

Referenced from: commits 8cd2837

Metadata

Metadata

Assignees

Labels

in: messagingIssues in messaging modules (jms, messaging)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions