Skip to content

Commit b83ae9a

Browse files
committed
Modify handing of deprecated method
1 parent c81df6c commit b83ae9a

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

java/org/apache/tomcat/util/buf/CloseableURLConnection.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,16 @@ public Object getContent(Class<?>[] classes) throws IOException {
280280

281281

282282
@Override
283-
@SuppressWarnings("deprecation")
283+
@Deprecated
284284
public Permission getPermission() throws IOException {
285-
return connection.getPermission();
285+
/*
286+
* This method is deprecated for removal in Java 25. If it isn't overridden the superclass will return {@code
287+
* java.security.AllPermission} which would be acceptable but, for consistency, it is better to oveerride the
288+
* method. Calling {@code getPermission()} on the wrapped connection would work until the method is removed.
289+
* Throwing {@code UnsupportedOperationException} works now since Tomcat never calls the method and will
290+
* continue to work once the method is removed.
291+
*/
292+
throw new UnsupportedOperationException();
286293
}
287294

288295

0 commit comments

Comments
 (0)