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

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
     new ec13d00  Avoid NPE on some failed resolutions
ec13d00 is described below

commit ec13d000e7a484f424be33998bd7e08288027904
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 e1ddeff..67d6284 100644
--- a/java/org/apache/naming/NamingContext.java
+++ b/java/org/apache/naming/NamingContext.java
@@ -873,6 +873,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 b1b836f..1e15ba2 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 10.0.5 (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