From ac3bbf7ddc1f6a55682264d66282e6ee8825f47a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Volkan=20Yaz=C4=B1c=C4=B1?= Date: Wed, 27 Nov 2024 13:49:51 +0000 Subject: [PATCH] 8344856: Remove calls to SecurityManager and doPrivileged in sun.net.www.protocol.ftp.FtpURLConnection after JEP 486 integration Reviewed-by: dfuchs --- .../net/www/protocol/ftp/FtpURLConnection.java | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/java.base/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java b/src/java.base/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java index f559cc5b820..493fda1c1b3 100644 --- a/src/java.base/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java +++ b/src/java.base/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,6 @@ import java.net.ProxySelector; import java.util.List; import java.util.StringTokenizer; import java.security.Permission; -import java.util.Properties; import sun.net.NetworkClient; import sun.net.util.IPAddressUtil; import sun.net.www.MessageHeader; @@ -53,7 +52,6 @@ import sun.net.www.protocol.http.HttpURLConnection; import sun.net.ftp.FtpClient; import sun.net.ftp.FtpProtocolException; import sun.net.www.ParseUtil; -import sun.security.action.GetPropertyAction; /** @@ -226,13 +224,7 @@ public class FtpURLConnection extends URLConnection { /** * Do we have to use a proxy? */ - @SuppressWarnings("removal") - ProxySelector sel = java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public ProxySelector run() { - return ProxySelector.getDefault(); - } - }); + ProxySelector sel = ProxySelector.getDefault(); if (sel != null) { URI uri = sun.net.www.ParseUtil.toURI(url); final List proxies; @@ -293,10 +285,8 @@ public class FtpURLConnection extends URLConnection { if (user == null) { user = "anonymous"; - Properties props = GetPropertyAction.privilegedGetProperties(); - String vers = props.getProperty("java.version"); - password = props.getProperty("ftp.protocol.user", - "Java" + vers + "@"); + String vers = System.getProperty("java.version"); + password = System.getProperty("ftp.protocol.user", "Java" + vers + "@"); } try { ftp = FtpClient.create();