[slf4j-dev] [JIRA] (SLF4J-414) MDCAdapter does not handle null map
QOS.CH (JIRA)
noreply-jira at qos.ch
Fri Jul 14 15:45:00 CEST 2017
Dmitry created SLF4J-414:
----------------------------
Summary: MDCAdapter does not handle null map
Key: SLF4J-414
URL: https://jira.qos.ch/browse/SLF4J-414
Project: SLF4J
Issue Type: Bug
Components: Implementations
Affects Versions: 1.7.25
Reporter: Dmitry
Assignee: SLF4J developers list
Priority: Minor
It turned out that method {{org.slf4j.impl.Log4jMDCAdapter#getCopyOfContextMap()}} may return {{null}} however {{org.slf4j.impl.Log4jMDCAdapter#setContextMap()}} does not handle this situation. That causes the Slf4j API consumer to eventually break with NPE in this code, depending on implementation / current logging backend provider:
{code}
Map<String, String> mcdContextMap = MDC.getCopyOfContextMap();
...
MDC.setContextMap(mcdContextMap);
{code}
It is expected that {{MDC.setContextMap()}} API treats {{null}} map as empty map.
--
This message was sent by Atlassian JIRA
(v7.3.1#73012)
More information about the slf4j-dev
mailing list