You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "jvz (via GitHub)" <gi...@apache.org> on 2023/04/13 00:14:58 UTC

[I] MDCContextMap::getCopy can return null causing an NPE in CloseableThreadContext (logging-log4j2)

jvz opened a new issue, #1426:
URL: https://github.com/apache/logging-log4j2/issues/1426

   ## 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.]
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] MDCContextMap::getCopy can return null causing an NPE in CloseableThreadContext (logging-log4j2)

Posted by "ppkarwasz (via GitHub)" <gi...@apache.org>.
ppkarwasz closed issue #1426: MDCContextMap::getCopy can return null causing an NPE in CloseableThreadContext
URL: https://github.com/apache/logging-log4j2/issues/1426


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] MDCContextMap::getCopy can return null causing an NPE in CloseableThreadContext (logging-log4j2)

Posted by "benkeil (via GitHub)" <gi...@apache.org>.
benkeil commented on issue #1426:
URL: https://github.com/apache/logging-log4j2/issues/1426#issuecomment-1862963701

   any news on this?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] MDCContextMap::getCopy can return null causing an NPE in CloseableThreadContext (logging-log4j2)

Posted by "ppkarwasz (via GitHub)" <gi...@apache.org>.
ppkarwasz commented on issue #1426:
URL: https://github.com/apache/logging-log4j2/issues/1426#issuecomment-1864270470

   @benkeil,
   
   Can you provide a PR?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org