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

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


The following commit(s) were added to refs/heads/10.1.x by this push:
     new 5c3e4730be Avoid possible NPE
5c3e4730be is described below

commit 5c3e4730be7cd1783b71c3f09203e4d7f4aa733f
Author: remm <r...@apache.org>
AuthorDate: Thu Sep 7 11:33:09 2023 +0200

    Avoid possible NPE
    
    The handling of an error accessing the descriptor was inconsistent.
    Found by coverity.
---
 java/org/apache/catalina/startup/HostConfig.java | 4 ++--
 webapps/docs/changelog.xml                       | 8 ++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/startup/HostConfig.java 
b/java/org/apache/catalina/startup/HostConfig.java
index fd3c77d290..001beb5ae2 100644
--- a/java/org/apache/catalina/startup/HostConfig.java
+++ b/java/org/apache/catalina/startup/HostConfig.java
@@ -577,9 +577,9 @@ public class HostConfig implements LifecycleListener {
         boolean isExternal = false;
         File expandedDocBase = null;
 
-        try (FileInputStream fis = new FileInputStream(contextXml)) {
+        try {
             synchronized (digesterLock) {
-                try {
+                try (FileInputStream fis = new FileInputStream(contextXml)) {
                     context = (Context) digester.parse(fis);
                 } catch (Exception e) {
                     
log.error(sm.getString("hostConfig.deployDescriptor.error", 
contextXml.getAbsolutePath()), e);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 7d7733fbce..72bff93758 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -105,6 +105,14 @@
   issues do not "pop up" wrt. others).
 -->
 <section name="Tomcat 10.1.14 (schultz)" rtext="in development">
+  <subsection name="Catalina">
+    <changelog>
+      <fix>
+        Fix handling of an error reading a context descriptor on deployment.
+        (remm)
+      </fix>
+    </changelog>
+  </subsection>
 </section>
 <section name="Tomcat 10.1.13 (markt)" rtext="2023-08-25">
   <subsection name="Catalina">


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

Reply via email to