You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2020/02/08 22:28:00 UTC

[logging-log4j2] 01/02: Log4j 2LOG4J2-2770 Fix NPE in JMX reconfiguration (#337)

This is an automated email from the ASF dual-hosted git repository.

rgoers pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit 50322a666422a89d9523e69b608f6ae3fa2245a2
Author: Bill Kuker <bk...@billkuker.com>
AuthorDate: Sat Feb 8 17:19:22 2020 -0500

    Log4j 2LOG4J2-2770 Fix NPE in JMX reconfiguration (#337)
    
    * Update ConfigurationSource.java
    
    I think this needs to store the data so that resetInputStream() works.
    The jmx function LoggerContextAdmin::getConfigText throws a NPE if you have previously called LoggerContextAdmin::setConfigText
    
    * Do not set data if URL is provided
    
    Avoids changing behavior of resetInputStream in cases that currently
    work correctly.
---
 .../java/org/apache/logging/log4j/core/config/ConfigurationSource.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationSource.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationSource.java
index 431d136..44dab54 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationSource.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationSource.java
@@ -149,6 +149,9 @@ public class ConfigurationSource {
         this.url = url;
         this.location = null;
         this.lastModified = lastModified;
+        if ( url == null ) {
+        	this.data = data;
+        }
     }
 
     /**