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

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


The following commit(s) were added to refs/heads/9.0.x by this push:
     new a357c5fa00 Better error handling
a357c5fa00 is described below

commit a357c5fa000fe493b3635908535e4dfac694bbb6
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 0f0b0241a6..9eb930300f 100644
--- a/java/org/apache/catalina/ssi/SSIServletExternalResolver.java
+++ b/java/org/apache/catalina/ssi/SSIServletExternalResolver.java
@@ -619,9 +619,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 a6625bbeb9..cc59f1d43e 100644
--- a/java/org/apache/catalina/startup/ContextConfig.java
+++ b/java/org/apache/catalina/startup/ContextConfig.java
@@ -1716,9 +1716,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);
                     }
                 }
             }
@@ -1737,9 +1736,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