diff --git a/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java b/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java index cbc5416cd60..77c03c5267d 100644 --- a/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java +++ b/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java @@ -404,10 +404,6 @@ final class DirectAudioDevice extends AbstractMixer { // $$fb part of fix for 4679187: Clip.open() throws unexpected Exceptions Toolkit.isFullySpecifiedAudioFormat(format); - // check for record permission - if (!isSource) { - JSSecurityManager.checkRecordPermission(); - } int encoding = PCM; if (format.getEncoding().equals(AudioFormat.Encoding.ULAW)) { encoding = ULAW; @@ -509,11 +505,6 @@ final class DirectAudioDevice extends AbstractMixer { @Override void implStart() { - // check for record permission - if (!isSource) { - JSSecurityManager.checkRecordPermission(); - } - synchronized (lockNative) { nStart(id, isSource); @@ -538,11 +529,6 @@ final class DirectAudioDevice extends AbstractMixer { @Override void implStop() { - // check for record permission - if (!isSource) { - JSSecurityManager.checkRecordPermission(); - } - if (monitoring) { getEventDispatcher().removeLineMonitor(this); monitoring = false; @@ -565,11 +551,6 @@ final class DirectAudioDevice extends AbstractMixer { @Override void implClose() { - // check for record permission - if (!isSource) { - JSSecurityManager.checkRecordPermission(); - } - // be sure to remove this monitor if (monitoring) { getEventDispatcher().removeLineMonitor(this); diff --git a/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java b/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java index e9b99ac1a10..91d5c0284b5 100644 --- a/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java +++ b/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java @@ -35,11 +35,9 @@ import java.util.List; import java.util.Properties; import java.util.ServiceLoader; -import javax.sound.sampled.AudioPermission; - -/** Managing security in the Java Sound implementation. - * This class contains all code that uses and is used by - * SecurityManager +/** + * Historically this class managed ensuring privileges to access resources + * it is still used to get those resources but no longer does checks. * * @author Matthias Pfisterer */ @@ -50,14 +48,6 @@ final class JSSecurityManager { private JSSecurityManager() { } - static void checkRecordPermission() throws SecurityException { - @SuppressWarnings("removal") - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkPermission(new AudioPermission("record")); - } - } - /** * Load properties from a file. *

diff --git a/src/java.desktop/share/classes/javax/sound/sampled/AudioPermission.java b/src/java.desktop/share/classes/javax/sound/sampled/AudioPermission.java index 296360a6550..f834c342b6f 100644 --- a/src/java.desktop/share/classes/javax/sound/sampled/AudioPermission.java +++ b/src/java.desktop/share/classes/javax/sound/sampled/AudioPermission.java @@ -40,10 +40,13 @@ import java.security.BasicPermission; * @apiNote * This permission cannot be used for controlling access to resources * as the Security Manager is no longer supported. + * Consequently this class is deprecated and may be removed in a future release. * * @author Kara Kytle * @since 1.3 + * @deprecated There is no replacement for this class. */ +@Deprecated(since="24", forRemoval=true) public class AudioPermission extends BasicPermission { /** diff --git a/test/jdk/javax/sound/sampled/Lines/GetLine.java b/test/jdk/javax/sound/sampled/Lines/GetLine.java index daa0114ae8a..e31c5ac8d6f 100644 --- a/test/jdk/javax/sound/sampled/Lines/GetLine.java +++ b/test/jdk/javax/sound/sampled/Lines/GetLine.java @@ -21,7 +21,6 @@ * questions. */ -import javax.sound.sampled.AudioPermission; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.DataLine; import javax.sound.sampled.Line; @@ -35,18 +34,6 @@ import javax.sound.sampled.SourceDataLine; */ public class GetLine { - static boolean isSoundAccessDenied = false; - static { - SecurityManager securityManager = System.getSecurityManager(); - if (securityManager != null) { - try { - securityManager.checkPermission(new AudioPermission("*")); - } catch (SecurityException e) { - isSoundAccessDenied = true; - } - } - } - static final int STATUS_PASSED = 0; static final int STATUS_FAILED = 2; static final int STATUS_TEMP = 95; @@ -80,9 +67,6 @@ public class GetLine { } try { l = AudioSystem.getLine(infos[0]); - } catch(SecurityException lue) { - log.println("SecurityException"); - return STATUS_PASSED; } catch (LineUnavailableException e1) { log.println("LUE"); return STATUS_PASSED;