Making a copy of "nativeHeaders" and working on a copy
otherwise we got ConcurrentModificationExceptions fixes gh-1345
This commit is contained in:
@@ -151,11 +151,18 @@ enum MessageHeaderPropagation
|
||||
nativeHeaders);
|
||||
}
|
||||
if (nativeHeaders instanceof Map<?, ?>) {
|
||||
((Map) nativeHeaders).put(key, Collections.singletonList(value));
|
||||
Map<String, List<String>> copy = toNativeHeaderMap(
|
||||
(Map<String, List<String>>) nativeHeaders);
|
||||
copy.put(key, Collections.singletonList(value));
|
||||
accessor.setHeader(NativeMessageHeaderAccessor.NATIVE_HEADERS, copy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, List<String>> toNativeHeaderMap(Map<String, List<String>> map) {
|
||||
return (map != null ? new LinkedMultiValueMap<>(map) : Collections.emptyMap());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get(MessageHeaderAccessor accessor, String key) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user