MDCContextMap::getCopy can return null causing an NPE in CloseableThreadContext #1426
Labels
api
Affects the public API
bug
Incorrect, unexpected, or unintended behavior of existing code
good first issue
Issues that are good for contributors looking to get started
slf4j
Affects SLF4J integration
Milestone
Description
MDCContextMap::getCopy
delegates toMDC::getCopyOfContextMap
which is documented as potentially returningnull
. This fact is respected withinMDCContextMap
, butThreadContextMap::getCopy
is documented as returning a non-null value. InCloseableThreadContext.Instance
, this causesNullPointerException
s in theputAll
method whenThreadContext::getContext
is invoked and later used.Configuration
Version: 2.20.0
Operating system: [OS and version]
JDK: [JDK distribution and version]
Logs
Reproduction
[An isolated test reproducing the test.
JUnit tests similar to the ones in the code base are extremely appreciated.]
The text was updated successfully, but these errors were encountered: