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 49c408c1eb Revert FileURLConnection changes - it does open an
InputStream
49c408c1eb is described below
commit 49c408c1ebba5097e6807e29e04d51fec11b0c02
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Jul 6 12:21:01 2026 +0100
Revert FileURLConnection changes - it does open an InputStream
---
java/org/apache/tomcat/util/buf/CloseableURLConnection.java | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/java/org/apache/tomcat/util/buf/CloseableURLConnection.java
b/java/org/apache/tomcat/util/buf/CloseableURLConnection.java
index fe54a11cd7..6b1d6d7c54 100644
--- a/java/org/apache/tomcat/util/buf/CloseableURLConnection.java
+++ b/java/org/apache/tomcat/util/buf/CloseableURLConnection.java
@@ -146,15 +146,12 @@ public final class CloseableURLConnection extends
URLConnection implements AutoC
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
}
- } else if
(connection.getClass().getName().equals("sun.net.www.protocol.file.FileURLConnection"))
{
+ } else if (!(connection instanceof HttpURLConnection)) {
/*
- * Internal JDK class so have to check by default name. If a JDK
uses another name it will be handled by the
- * final block.
+ * sun.net.www.protocol.file.FileURLConnection is known to open an
InputStream for files.
*
- * NO-OP - known not to open a stream to read metadata
+ * Other cases could have used a stream as a side effect, possibly
causing file locking.
*/
- } else if (!(connection instanceof HttpURLConnection)) {
- // Other cases 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 (Throwable t) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]