@@ -547,7 +547,6 @@ private void issueCommandCheck(String cmd) throws sun.net.ftp.FtpProtocolExcepti
547547 * @return the connected <code>Socket</code>
548548 * @throws IOException if the connection was unsuccessful.
549549 */
550- @ SuppressWarnings ("removal" )
551550 private Socket openPassiveDataConnection (String cmd ) throws sun .net .ftp .FtpProtocolException , IOException {
552551 String serverAnswer ;
553552 int port ;
@@ -629,27 +628,20 @@ private Socket openPassiveDataConnection(String cmd) throws sun.net.ftp.FtpProto
629628 Socket s ;
630629 if (proxy != null ) {
631630 if (proxy .type () == Proxy .Type .SOCKS ) {
632- s = AccessController .doPrivileged (
633- new PrivilegedAction <Socket >() {
634-
635- public Socket run () {
636- return new Socket (proxy );
637- }
638- });
631+ PrivilegedAction <Socket > pa = () -> new Socket (proxy );
632+ @ SuppressWarnings ("removal" )
633+ var tmp = AccessController .doPrivileged (pa );
634+ s = tmp ;
639635 } else {
640636 s = new Socket (Proxy .NO_PROXY );
641637 }
642638 } else {
643639 s = new Socket ();
644640 }
645641
646- InetAddress serverAddress = AccessController .doPrivileged (
647- new PrivilegedAction <InetAddress >() {
648- @ Override
649- public InetAddress run () {
650- return server .getLocalAddress ();
651- }
652- });
642+ PrivilegedAction <InetAddress > pa = () -> server .getLocalAddress ();
643+ @ SuppressWarnings ("removal" )
644+ InetAddress serverAddress = AccessController .doPrivileged (pa );
653645
654646 // Bind the socket to the same address as the control channel. This
655647 // is needed in case of multi-homed systems.
@@ -918,18 +910,14 @@ private void tryConnect(InetSocketAddress dest, int timeout) throws IOException
918910 in = new BufferedInputStream (server .getInputStream ());
919911 }
920912
921- @ SuppressWarnings ("removal" )
922913 private Socket doConnect (InetSocketAddress dest , int timeout ) throws IOException {
923914 Socket s ;
924915 if (proxy != null ) {
925916 if (proxy .type () == Proxy .Type .SOCKS ) {
926- s = AccessController .doPrivileged (
927- new PrivilegedAction <Socket >() {
928-
929- public Socket run () {
930- return new Socket (proxy );
931- }
932- });
917+ PrivilegedAction <Socket > pa = () -> new Socket (proxy );
918+ @ SuppressWarnings ("removal" )
919+ var tmp = AccessController .doPrivileged (pa );
920+ s = tmp ;
933921 } else {
934922 s = new Socket (Proxy .NO_PROXY );
935923 }
0 commit comments