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

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


The following commit(s) were added to refs/heads/main by this push:
     new 76b8e9d48e Add extra case from TldCache
76b8e9d48e is described below

commit 76b8e9d48e143256991ebc793a5172175c911b55
Author: remm <[email protected]>
AuthorDate: Wed Jul 1 12:15:33 2026 +0200

    Add extra case from TldCache
---
 java/org/apache/tomcat/util/buf/CloseableURLConnection.java | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/java/org/apache/tomcat/util/buf/CloseableURLConnection.java 
b/java/org/apache/tomcat/util/buf/CloseableURLConnection.java
index e6807fd058..e635516cc0 100644
--- a/java/org/apache/tomcat/util/buf/CloseableURLConnection.java
+++ b/java/org/apache/tomcat/util/buf/CloseableURLConnection.java
@@ -146,6 +146,14 @@ public final class CloseableURLConnection extends 
URLConnection implements AutoC
             } catch (Exception e) {
                 ExceptionUtils.handleThrowable(e);
             }
+        } else if (!(connection instanceof HttpURLConnection)) {
+            // Other cases like FileURLConnection could have used a stream as 
a side effect,
+            // possibly causing file locking.
+            try (@SuppressWarnings("unused") InputStream is = 
connection.getInputStream()) {
+                // Explicitly close the InputStream to release its native 
resources.
+            } catch (Exception e) {
+                ExceptionUtils.handleThrowable(e);
+            }
         }
 
         if (connection instanceof HttpURLConnection) {


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

Reply via email to