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

remm 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 bd8ee28  Avoid NPE on some failed resolutions
bd8ee28 is described below

commit bd8ee282d509f6533a6bcd5e3beb316123c261bf
Author: remm <r...@apache.org>
AuthorDate: Tue Mar 16 15:59:23 2021 +0100

    Avoid NPE on some failed resolutions
    
    In some cases, the factory returns null, so treat it as a usual naming
    failure.
---
 java/org/apache/naming/NamingContext.java | 3 +++
 webapps/docs/changelog.xml                | 8 ++++++++
 2 files changed, 11 insertions(+)

diff --git a/java/org/apache/naming/NamingContext.java 
b/java/org/apache/naming/NamingContext.java
index b6a97bb..37b42e3 100644
--- a/java/org/apache/naming/NamingContext.java
+++ b/java/org/apache/naming/NamingContext.java
@@ -847,6 +847,9 @@ public class NamingContext implements Context {
                             entry.value = obj;
                         }
                     }
+                    if (obj == null) {
+                        throw new 
NamingException(sm.getString("namingContext.failResolvingReference"));
+                    }
                     return obj;
                 } catch (NamingException e) {
                     throw e;
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index d77a083..7ce868d 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -104,6 +104,14 @@
   issues do not "pop up" wrt. others).
 -->
 <section name="Tomcat 8.5.65 (markt)" rtext="in development">
+  <subsection name="Catalina">
+    <changelog>
+      <fix>
+        Avoid NPE when a JNDI reference cannot be resolved in favor of a
+        NamingException. (remm)
+      </fix>
+    </changelog>
+  </subsection>
   <subsection name="Coyote">
     <changelog>
       <fix>


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

Reply via email to