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

markt-asf 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 3714594b32 Better error handling
3714594b32 is described below

commit 3714594b32c8851d7092baabf86b39170a51d7dc
Author: Mark Thomas <[email protected]>
AuthorDate: Tue Jun 30 20:35:16 2026 +0100

    Better error handling
    
    NPE is also possible. Use Exception just in case.
    Don't return invalid value if the correct value is read but the stream
    closure fails.
---
 java/org/apache/catalina/ssi/SSIServletExternalResolver.java |  5 ++---
 java/org/apache/catalina/startup/ContextConfig.java          | 10 ++++------
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/java/org/apache/catalina/ssi/SSIServletExternalResolver.java 
b/java/org/apache/catalina/ssi/SSIServletExternalResolver.java
index 59208c5628..1b30c5463c 100644
--- a/java/org/apache/catalina/ssi/SSIServletExternalResolver.java
+++ b/java/org/apache/catalina/ssi/SSIServletExternalResolver.java
@@ -618,9 +618,8 @@ public class SSIServletExternalResolver implements 
SSIExternalResolver {
             if (urlConnection != null) {
                 try {
                     urlConnection.getInputStream().close();
-                } catch (IOException ioe) {
-                    ExceptionUtils.handleThrowable(ioe);
-                    lastModified = 0;
+                } catch (Exception e) {
+                    ExceptionUtils.handleThrowable(e);
                 }
             }
         }
diff --git a/java/org/apache/catalina/startup/ContextConfig.java 
b/java/org/apache/catalina/startup/ContextConfig.java
index 7df247a7b6..5439096706 100644
--- a/java/org/apache/catalina/startup/ContextConfig.java
+++ b/java/org/apache/catalina/startup/ContextConfig.java
@@ -1708,9 +1708,8 @@ public class ContextConfig implements LifecycleListener {
                 if (uc != null) {
                     try {
                         uc.getInputStream().close();
-                    } catch (IOException ioe) {
-                        ExceptionUtils.handleThrowable(ioe);
-                        globalTimeStamp = -1;
+                    } catch (Exception e) {
+                        ExceptionUtils.handleThrowable(e);
                     }
                 }
             }
@@ -1729,9 +1728,8 @@ public class ContextConfig implements LifecycleListener {
                 if (uc != null) {
                     try {
                         uc.getInputStream().close();
-                    } catch (IOException ioe) {
-                        ExceptionUtils.handleThrowable(ioe);
-                        hostTimeStamp = -1;
+                    } catch (Exception e) {
+                        ExceptionUtils.handleThrowable(e);
                     }
                 }
             }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to