8344856: Remove calls to SecurityManager and doPrivileged in sun.net.www.protocol.ftp.FtpURLConnection after JEP 486 integration
Reviewed-by: dfuchs
This commit is contained in:
parent
a1473ec302
commit
ac3bbf7ddc
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* 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.List;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import java.security.Permission;
|
import java.security.Permission;
|
||||||
import java.util.Properties;
|
|
||||||
import sun.net.NetworkClient;
|
import sun.net.NetworkClient;
|
||||||
import sun.net.util.IPAddressUtil;
|
import sun.net.util.IPAddressUtil;
|
||||||
import sun.net.www.MessageHeader;
|
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.FtpClient;
|
||||||
import sun.net.ftp.FtpProtocolException;
|
import sun.net.ftp.FtpProtocolException;
|
||||||
import sun.net.www.ParseUtil;
|
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?
|
* Do we have to use a proxy?
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("removal")
|
ProxySelector sel = ProxySelector.getDefault();
|
||||||
ProxySelector sel = java.security.AccessController.doPrivileged(
|
|
||||||
new java.security.PrivilegedAction<ProxySelector>() {
|
|
||||||
public ProxySelector run() {
|
|
||||||
return ProxySelector.getDefault();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (sel != null) {
|
if (sel != null) {
|
||||||
URI uri = sun.net.www.ParseUtil.toURI(url);
|
URI uri = sun.net.www.ParseUtil.toURI(url);
|
||||||
final List<Proxy> proxies;
|
final List<Proxy> proxies;
|
||||||
@ -293,10 +285,8 @@ public class FtpURLConnection extends URLConnection {
|
|||||||
|
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
user = "anonymous";
|
user = "anonymous";
|
||||||
Properties props = GetPropertyAction.privilegedGetProperties();
|
String vers = System.getProperty("java.version");
|
||||||
String vers = props.getProperty("java.version");
|
password = System.getProperty("ftp.protocol.user", "Java" + vers + "@");
|
||||||
password = props.getProperty("ftp.protocol.user",
|
|
||||||
"Java" + vers + "@");
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
ftp = FtpClient.create();
|
ftp = FtpClient.create();
|
||||||
|
Loading…
Reference in New Issue
Block a user