diff --git a/src/jdk.net/aix/classes/jdk/net/AIXSocketOptions.java b/src/jdk.net/aix/classes/jdk/net/AIXSocketOptions.java index 086c346ff8f..604386b3718 100644 --- a/src/jdk.net/aix/classes/jdk/net/AIXSocketOptions.java +++ b/src/jdk.net/aix/classes/jdk/net/AIXSocketOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 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 @@ -27,12 +27,10 @@ package jdk.net; import java.net.SocketException; import java.nio.file.attribute.UserPrincipal; import java.nio.file.attribute.GroupPrincipal; -import java.security.AccessController; -import java.security.PrivilegedAction; import jdk.net.ExtendedSocketOptions.PlatformSocketOptions; import sun.nio.fs.UnixUserPrincipals; -@SuppressWarnings({"removal", "restricted"}) +@SuppressWarnings("restricted") class AIXSocketOptions extends PlatformSocketOptions { public AIXSocketOptions() { @@ -131,13 +129,6 @@ class AIXSocketOptions extends PlatformSocketOptions { private static native boolean keepAliveOptionsSupported0(); private static native boolean quickAckSupported0(); static { - if (System.getSecurityManager() == null) { - System.loadLibrary("extnet"); - } else { - AccessController.doPrivileged((PrivilegedAction) () -> { - System.loadLibrary("extnet"); - return null; - }); - } + System.loadLibrary("extnet"); } } diff --git a/src/jdk.net/linux/classes/jdk/net/LinuxSocketOptions.java b/src/jdk.net/linux/classes/jdk/net/LinuxSocketOptions.java index 8d3ceeebfa9..bffe094ea45 100644 --- a/src/jdk.net/linux/classes/jdk/net/LinuxSocketOptions.java +++ b/src/jdk.net/linux/classes/jdk/net/LinuxSocketOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -27,12 +27,10 @@ package jdk.net; import java.net.SocketException; import java.nio.file.attribute.UserPrincipal; import java.nio.file.attribute.GroupPrincipal; -import java.security.AccessController; -import java.security.PrivilegedAction; import jdk.net.ExtendedSocketOptions.PlatformSocketOptions; import sun.nio.fs.UnixUserPrincipals; -@SuppressWarnings({"removal", "restricted"}) +@SuppressWarnings("restricted") class LinuxSocketOptions extends PlatformSocketOptions { public LinuxSocketOptions() { @@ -143,14 +141,7 @@ class LinuxSocketOptions extends PlatformSocketOptions { private static native boolean incomingNapiIdSupported0(); private static native int getIncomingNapiId0(int fd) throws SocketException; static { - if (System.getSecurityManager() == null) { - System.loadLibrary("extnet"); - } else { - AccessController.doPrivileged((PrivilegedAction) () -> { - System.loadLibrary("extnet"); - return null; - }); - } + System.loadLibrary("extnet"); } } diff --git a/src/jdk.net/macosx/classes/jdk/net/MacOSXSocketOptions.java b/src/jdk.net/macosx/classes/jdk/net/MacOSXSocketOptions.java index c2912e8b808..23055954b21 100644 --- a/src/jdk.net/macosx/classes/jdk/net/MacOSXSocketOptions.java +++ b/src/jdk.net/macosx/classes/jdk/net/MacOSXSocketOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 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 @@ -27,12 +27,10 @@ package jdk.net; import java.net.SocketException; import java.nio.file.attribute.UserPrincipal; import java.nio.file.attribute.GroupPrincipal; -import java.security.AccessController; -import java.security.PrivilegedAction; import jdk.net.ExtendedSocketOptions.PlatformSocketOptions; import sun.nio.fs.UnixUserPrincipals; -@SuppressWarnings({"removal", "restricted"}) +@SuppressWarnings("restricted") class MacOSXSocketOptions extends PlatformSocketOptions { public MacOSXSocketOptions() { @@ -116,13 +114,6 @@ class MacOSXSocketOptions extends PlatformSocketOptions { private static native boolean ipDontFragmentSupported0(); static { - if (System.getSecurityManager() == null) { - System.loadLibrary("extnet"); - } else { - AccessController.doPrivileged((PrivilegedAction) () -> { - System.loadLibrary("extnet"); - return null; - }); - } + System.loadLibrary("extnet"); } } diff --git a/src/jdk.net/share/classes/jdk/nio/Channels.java b/src/jdk.net/share/classes/jdk/nio/Channels.java index fbbbaa2b3a4..fa15cf189fd 100644 --- a/src/jdk.net/share/classes/jdk/nio/Channels.java +++ b/src/jdk.net/share/classes/jdk/nio/Channels.java @@ -148,13 +148,6 @@ public final class Channels { if (!fd.valid()) throw new IllegalArgumentException("file descriptor is not valid"); - @SuppressWarnings("removal") - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkRead(fd); - sm.checkWrite(fd); - } - SelectorProvider provider = SelectorProvider.provider(); if (!(provider instanceof SelectorProviderImpl)) throw new UnsupportedOperationException("custom SelectorProvider"); diff --git a/src/jdk.net/windows/classes/jdk/net/WindowsSocketOptions.java b/src/jdk.net/windows/classes/jdk/net/WindowsSocketOptions.java index f5f69e20517..ad824168e79 100644 --- a/src/jdk.net/windows/classes/jdk/net/WindowsSocketOptions.java +++ b/src/jdk.net/windows/classes/jdk/net/WindowsSocketOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 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 @@ -25,12 +25,10 @@ package jdk.net; import java.net.SocketException; -import java.security.AccessController; -import java.security.PrivilegedAction; import jdk.net.ExtendedSocketOptions.PlatformSocketOptions; -@SuppressWarnings({"removal", "restricted"}) +@SuppressWarnings("restricted") class WindowsSocketOptions extends PlatformSocketOptions { public WindowsSocketOptions() { @@ -97,13 +95,6 @@ class WindowsSocketOptions extends PlatformSocketOptions { private static native int getTcpKeepAliveIntvl0(int fd) throws SocketException; static { - if (System.getSecurityManager() == null) { - System.loadLibrary("extnet"); - } else { - AccessController.doPrivileged((PrivilegedAction) () -> { - System.loadLibrary("extnet"); - return null; - }); - } + System.loadLibrary("extnet"); } }