[JIRA] (SLF4J-414) MDCAdapter does not handle null map

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[JIRA] (SLF4J-414) MDCAdapter does not handle null map

JIRA noreply-jira@qos.ch
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)
_______________________________________________
slf4j-dev mailing list
[hidden email]
http://mailman.qos.ch/mailman/listinfo/slf4j-dev
Loading...