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

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 6a4381c  Fix BZ 65684 - avoid NPE
6a4381c is described below

commit 6a4381c2c6684a08b345dd4fade261b317be9d88
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Nov 24 17:53:14 2021 +0000

    Fix BZ 65684 - avoid NPE
    
    https://bz.apache.org/bugzilla/show_bug.cgi?id=65684
---
 java/org/apache/juli/ClassLoaderLogManager.java | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/java/org/apache/juli/ClassLoaderLogManager.java 
b/java/org/apache/juli/ClassLoaderLogManager.java
index 42e8f11..227b4e1 100644
--- a/java/org/apache/juli/ClassLoaderLogManager.java
+++ b/java/org/apache/juli/ClassLoaderLogManager.java
@@ -292,24 +292,25 @@ public class ClassLoaderLogManager extends LogManager {
 
 
     private synchronized String findProperty(String name) {
-        ClassLoader classLoader = Thread.currentThread()
-                .getContextClassLoader();
+        ClassLoader classLoader = 
Thread.currentThread().getContextClassLoader();
         ClassLoaderLogInfo info = getClassLoaderInfo(classLoader);
         String result = info.props.getProperty(name);
         // If the property was not found, and the current classloader had no
         // configuration (property list is empty), look for the parent 
classloader
         // properties.
         if ((result == null) && (info.props.isEmpty())) {
-            ClassLoader current = classLoader.getParent();
-            while (current != null) {
-                info = classLoaderLoggers.get(current);
-                if (info != null) {
-                    result = info.props.getProperty(name);
-                    if ((result != null) || (!info.props.isEmpty())) {
-                        break;
+            if (classLoader != null) {
+                ClassLoader current = classLoader.getParent();
+                while (current != null) {
+                    info = classLoaderLoggers.get(current);
+                    if (info != null) {
+                        result = info.props.getProperty(name);
+                        if ((result != null) || (!info.props.isEmpty())) {
+                            break;
+                        }
                     }
+                    current = current.getParent();
                 }
-                current = current.getParent();
             }
             if (result == null) {
                 result = super.getProperty(name);

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to