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

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


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

commit ea07e0686a1caa006d66eb557d81f210409bc6ea
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 +++++++++++----------
 webapps/docs/changelog.xml                      |  4 ++++
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/java/org/apache/juli/ClassLoaderLogManager.java 
b/java/org/apache/juli/ClassLoaderLogManager.java
index a9dc664..421fce0 100644
--- a/java/org/apache/juli/ClassLoaderLogManager.java
+++ b/java/org/apache/juli/ClassLoaderLogManager.java
@@ -300,24 +300,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);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 7afc6de..6a9b145 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -111,6 +111,10 @@
         Make SPNEGO authentication more robust for the case where the provided
         credential has expired. (markt)
       </fix>
+      <fix>
+        <bug>65684</bug>: Fix a potential <code>NullPointerException</code> 
when
+        using JULI. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">

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

Reply via email to