(tomcat) branch main updated: Add extra case from TldCache

[email protected]
Newsgroups gmane.comp.jakarta.tomcat.devel
Message-ID <178290094335.3897213.6336081987993586714@gitbox3-he-fi.apache.org>
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) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.