Closed
Description
Description
MDCContextMap::getCopy
delegates to MDC::getCopyOfContextMap
which is documented as potentially returning null
. This fact is respected within MDCContextMap
, but ThreadContextMap::getCopy
is documented as returning a non-null value. In CloseableThreadContext.Instance
, this causes NullPointerException
s in the putAll
method when ThreadContext::getContext
is invoked and later used.
Configuration
Version: 2.20.0
Operating system: [OS and version]
JDK: [JDK distribution and version]
Logs
java.lang.NullPointerException: null
at org.apache.logging.log4j.CloseableThreadContext$Instance.putAll(CloseableThreadContext.java:170)
at org.apache.logging.log4j.CloseableThreadContext.putAll(CloseableThreadContext.java:100)
Reproduction
[An isolated test reproducing the test.
JUnit tests similar to the ones in the code base are extremely appreciated.]