Skip to content

Commit ac3bbf7

Browse files
vydfuch
authored andcommitted
8344856: Remove calls to SecurityManager and doPrivileged in sun.net.www.protocol.ftp.FtpURLConnection after JEP 486 integration
Reviewed-by: dfuchs
1 parent a1473ec commit ac3bbf7

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

src/java.base/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1994, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1994, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,6 @@
4343
import java.util.List;
4444
import java.util.StringTokenizer;
4545
import java.security.Permission;
46-
import java.util.Properties;
4746
import sun.net.NetworkClient;
4847
import sun.net.util.IPAddressUtil;
4948
import sun.net.www.MessageHeader;
@@ -53,7 +52,6 @@
5352
import sun.net.ftp.FtpClient;
5453
import sun.net.ftp.FtpProtocolException;
5554
import sun.net.www.ParseUtil;
56-
import sun.security.action.GetPropertyAction;
5755

5856

5957
/**
@@ -226,13 +224,7 @@ public synchronized void connect() throws IOException {
226224
/**
227225
* Do we have to use a proxy?
228226
*/
229-
@SuppressWarnings("removal")
230-
ProxySelector sel = java.security.AccessController.doPrivileged(
231-
new java.security.PrivilegedAction<ProxySelector>() {
232-
public ProxySelector run() {
233-
return ProxySelector.getDefault();
234-
}
235-
});
227+
ProxySelector sel = ProxySelector.getDefault();
236228
if (sel != null) {
237229
URI uri = sun.net.www.ParseUtil.toURI(url);
238230
final List<Proxy> proxies;
@@ -293,10 +285,8 @@ public ProxySelector run() {
293285

294286
if (user == null) {
295287
user = "anonymous";
296-
Properties props = GetPropertyAction.privilegedGetProperties();
297-
String vers = props.getProperty("java.version");
298-
password = props.getProperty("ftp.protocol.user",
299-
"Java" + vers + "@");
288+
String vers = System.getProperty("java.version");
289+
password = System.getProperty("ftp.protocol.user", "Java" + vers + "@");
300290
}
301291
try {
302292
ftp = FtpClient.create();

0 commit comments

Comments
 (0)