Using Map.of
in a ContextDataProvider
implementation throws UOE
#2098
Labels
bug
Incorrect, unexpected, or unintended behavior of existing code
Milestone
Description
I'm using logj2 with a custom
ContextDataProvider
, and then using the aws lambda appender. MyContextDataProvider
implementation usesMap.of
methods from JDK to create cheap immutable maps, but apparently that doesn't work and throws UOE.In the stacktrace it's shown that a method down the stack invokes
ImmutableCollections.AbstractImmutableMap::clear
, which throws UOE. Interesting enough, in many online examples they useCollections.emptyMap()
for the empty map, which doesn't throw UOE onclear
.What puzzles me though is that I wasn't able to reproduce this issue with the log4j2-core console appender. Is the amazon appender doing something strange, or is this a bug of log4j2-core?
Configuration
Version: 2.22.0
Operating system: Linux
JDK: 21 (amazon)
Logs
The text was updated successfully, but these errors were encountered: