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

markt-asf 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 b83ae9a8de Modify handing of deprecated method
b83ae9a8de is described below

commit b83ae9a8de4afa70b811609333b90fa163562a2b
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Jul 2 12:22:21 2026 +0100

    Modify handing of deprecated method
---
 java/org/apache/tomcat/util/buf/CloseableURLConnection.java | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/tomcat/util/buf/CloseableURLConnection.java 
b/java/org/apache/tomcat/util/buf/CloseableURLConnection.java
index e635516cc0..ea43b0a085 100644
--- a/java/org/apache/tomcat/util/buf/CloseableURLConnection.java
+++ b/java/org/apache/tomcat/util/buf/CloseableURLConnection.java
@@ -280,9 +280,16 @@ public final class CloseableURLConnection extends 
URLConnection implements AutoC
 
 
     @Override
-    @SuppressWarnings("deprecation")
+    @Deprecated
     public Permission getPermission() throws IOException {
-        return connection.getPermission();
+        /*
+         * This method is deprecated for removal in Java 25. If it isn't 
overridden the superclass will return {@code
+         * java.security.AllPermission} which would be acceptable but, for 
consistency, it is better to oveerride the
+         * method. Calling {@code getPermission()} on the wrapped connection 
would work until the method is removed.
+         * Throwing {@code UnsupportedOperationException} works now since 
Tomcat never calls the method and will
+         * continue to work once the method is removed.
+         */
+        throw new UnsupportedOperationException();
     }
 
 


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

Reply via email to