This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new 92d0279166 Restore fd leak protection
92d0279166 is described below
commit 92d0279166dc020c4ba19c0419dda20faf172ef9
Author: Mark Thomas <[email protected]>
AuthorDate: Tue Jun 30 18:30:04 2026 +0100
Restore fd leak protection
---
.../org/apache/catalina/startup/ContextConfig.java | 24 ++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/java/org/apache/catalina/startup/ContextConfig.java
b/java/org/apache/catalina/startup/ContextConfig.java
index ac6adf4a4f..fb0259d799 100644
--- a/java/org/apache/catalina/startup/ContextConfig.java
+++ b/java/org/apache/catalina/startup/ContextConfig.java
@@ -1693,24 +1693,44 @@ public class ContextConfig implements LifecycleListener
{
long hostTimeStamp = 0;
if (globalWebXml != null) {
+ URLConnection uc = null;
try {
URI uri = new URI(globalWebXml.getSystemId());
URL url = uri.toURL();
- URLConnection uc = url.openConnection();
+ uc = url.openConnection();
globalTimeStamp = uc.getLastModified();
} catch (IOException | URISyntaxException |
IllegalArgumentException e) {
globalTimeStamp = -1;
+ } finally {
+ if (uc != null) {
+ try {
+ uc.getInputStream().close();
+ } catch (IOException ioe) {
+ ExceptionUtils.handleThrowable(ioe);
+ globalTimeStamp = -1;
+ }
+ }
}
}
if (hostWebXml != null) {
+ URLConnection uc = null;
try {
URI uri = new URI(hostWebXml.getSystemId());
URL url = uri.toURL();
- URLConnection uc = url.openConnection();
+ uc = url.openConnection();
hostTimeStamp = uc.getLastModified();
} catch (IOException | URISyntaxException |
IllegalArgumentException e) {
hostTimeStamp = -1;
+ } finally {
+ if (uc != null) {
+ try {
+ uc.getInputStream().close();
+ } catch (IOException ioe) {
+ ExceptionUtils.handleThrowable(ioe);
+ hostTimeStamp = -1;
+ }
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]