You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Andre Elis (Jira)" <ji...@apache.org> on 2020/03/23 05:26:00 UTC

[jira] [Updated] (LOG4J2-2809) java.lang.NullPointerException at java9 org.apache.logging.log4j.util.StackLocator.calcLocation()

     [ https://issues.apache.org/jira/browse/LOG4J2-2809?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andre Elis updated LOG4J2-2809:
-------------------------------
    Description: 
When log() is called from a class using an instance created/stored at ThreadLocal 
 its StackWalker.StackFrame names changes to "WrappingClass$ClassFromThreadLocal".

This causes to throw NPE because walker.walk(LOCATOR) returns null.
{code:java}
StackTraceElement element = walker.walk(LOCATOR).toStackTraceElement();
{code}
It is suggested to check the result of walk() for null-ness and react in the way different from NPE.

  was:
When log() is called from a class using an instance created/stored at ThreadLocal 
its StackWalker.StackFrame names changes to "WrappingClass$ClassFromThreadLocal".

This causes to throw NPE because walker.walk(LOCATOR) returns null.
{code:java}
// StackTraceElement element = walker.walk(LOCATOR).toStackTraceElement();
{code}
It is suggested to check the result of walk() for null-ness and react in the way different from NPE.


> java.lang.NullPointerException at java9 org.apache.logging.log4j.util.StackLocator.calcLocation() 
> --------------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-2809
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2809
>             Project: Log4j 2
>          Issue Type: Bug
>            Reporter: Andre Elis
>            Assignee: Ralph Goers
>            Priority: Major
>
> When log() is called from a class using an instance created/stored at ThreadLocal 
>  its StackWalker.StackFrame names changes to "WrappingClass$ClassFromThreadLocal".
> This causes to throw NPE because walker.walk(LOCATOR) returns null.
> {code:java}
> StackTraceElement element = walker.walk(LOCATOR).toStackTraceElement();
> {code}
> It is suggested to check the result of walk() for null-ness and react in the way different from NPE.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)