[ 
https://issues.apache.org/jira/browse/LOG4J2-3231?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17459587#comment-17459587
 ] 

Gary D. Gregory edited comment on LOG4J2-3231 at 12/15/21, 1:17 AM:
--------------------------------------------------------------------

Hello [~phongn] 

Thank you for your report. May you please provide a simple unit test to 
reproduce this issue?

Also, please post the NPE.

This simple test passes:
{code:java}
package org.apache.logging.log4j.core.net;

import org.junit.jupiter.api.Test;

public class JndiManagerTest {

    @Test
    public void testIsJndiEnabled() {                    
        assertFalse(JndiManager.isJndiEnabled());
    }
} {code}
 


was (Author: garydgregory):
Hello [~phongn] 

Thank you for your report. May you please provide a simple unit test to 
reproduce this issue?

This simple test passes:
{code:java}
package org.apache.logging.log4j.core.net;

import org.junit.jupiter.api.Test;

public class JndiManagerTest {

    @Test
    public void testIsJndiEnabled() {                    
        assertFalse(JndiManager.isJndiEnabled());
    }
} {code}
 

> JndiManager.isJndiEnabled generates a call to NetUtils.getLocalIps
> ------------------------------------------------------------------
>
>                 Key: LOG4J2-3231
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3231
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.16.0
>            Reporter: Phong X. Nguyen
>            Priority: Major
>
> While trying to upgrade from 2.15.0 to 2.16.0, we discovered some of our unit 
> tests were failing. On further investigation, we realized that the new 
> {{JndiManager.isJndiEnabled()}} method, on first call, causes initialization 
> of all static members of {{{}JndiManager{}}}, including a call to 
> {{{}NetUtils.getLocalIps{}}}. In at least one of our unit test frameworks, 
> this generates a NullPointerException. 
> Could some of the {{permanentAllowed}} lists initialization be deferred to 
> avoid this issue? 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to