8342281: Deprecate for removal javax.sound.sampled.AudioPermission
Reviewed-by: honkar, kizune
This commit is contained in:
parent
4fbf272017
commit
a01aa22026
@ -404,10 +404,6 @@ final class DirectAudioDevice extends AbstractMixer {
|
|||||||
// $$fb part of fix for 4679187: Clip.open() throws unexpected Exceptions
|
// $$fb part of fix for 4679187: Clip.open() throws unexpected Exceptions
|
||||||
Toolkit.isFullySpecifiedAudioFormat(format);
|
Toolkit.isFullySpecifiedAudioFormat(format);
|
||||||
|
|
||||||
// check for record permission
|
|
||||||
if (!isSource) {
|
|
||||||
JSSecurityManager.checkRecordPermission();
|
|
||||||
}
|
|
||||||
int encoding = PCM;
|
int encoding = PCM;
|
||||||
if (format.getEncoding().equals(AudioFormat.Encoding.ULAW)) {
|
if (format.getEncoding().equals(AudioFormat.Encoding.ULAW)) {
|
||||||
encoding = ULAW;
|
encoding = ULAW;
|
||||||
@ -509,11 +505,6 @@ final class DirectAudioDevice extends AbstractMixer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
void implStart() {
|
void implStart() {
|
||||||
// check for record permission
|
|
||||||
if (!isSource) {
|
|
||||||
JSSecurityManager.checkRecordPermission();
|
|
||||||
}
|
|
||||||
|
|
||||||
synchronized (lockNative)
|
synchronized (lockNative)
|
||||||
{
|
{
|
||||||
nStart(id, isSource);
|
nStart(id, isSource);
|
||||||
@ -538,11 +529,6 @@ final class DirectAudioDevice extends AbstractMixer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
void implStop() {
|
void implStop() {
|
||||||
// check for record permission
|
|
||||||
if (!isSource) {
|
|
||||||
JSSecurityManager.checkRecordPermission();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (monitoring) {
|
if (monitoring) {
|
||||||
getEventDispatcher().removeLineMonitor(this);
|
getEventDispatcher().removeLineMonitor(this);
|
||||||
monitoring = false;
|
monitoring = false;
|
||||||
@ -565,11 +551,6 @@ final class DirectAudioDevice extends AbstractMixer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
void implClose() {
|
void implClose() {
|
||||||
// check for record permission
|
|
||||||
if (!isSource) {
|
|
||||||
JSSecurityManager.checkRecordPermission();
|
|
||||||
}
|
|
||||||
|
|
||||||
// be sure to remove this monitor
|
// be sure to remove this monitor
|
||||||
if (monitoring) {
|
if (monitoring) {
|
||||||
getEventDispatcher().removeLineMonitor(this);
|
getEventDispatcher().removeLineMonitor(this);
|
||||||
|
@ -35,11 +35,9 @@ import java.util.List;
|
|||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.ServiceLoader;
|
import java.util.ServiceLoader;
|
||||||
|
|
||||||
import javax.sound.sampled.AudioPermission;
|
/**
|
||||||
|
* Historically this class managed ensuring privileges to access resources
|
||||||
/** Managing security in the Java Sound implementation.
|
* it is still used to get those resources but no longer does checks.
|
||||||
* This class contains all code that uses and is used by
|
|
||||||
* SecurityManager
|
|
||||||
*
|
*
|
||||||
* @author Matthias Pfisterer
|
* @author Matthias Pfisterer
|
||||||
*/
|
*/
|
||||||
@ -50,14 +48,6 @@ final class JSSecurityManager {
|
|||||||
private 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.
|
* Load properties from a file.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -40,10 +40,13 @@ import java.security.BasicPermission;
|
|||||||
* @apiNote
|
* @apiNote
|
||||||
* This permission cannot be used for controlling access to resources
|
* This permission cannot be used for controlling access to resources
|
||||||
* as the Security Manager is no longer supported.
|
* as the Security Manager is no longer supported.
|
||||||
|
* Consequently this class is deprecated and may be removed in a future release.
|
||||||
*
|
*
|
||||||
* @author Kara Kytle
|
* @author Kara Kytle
|
||||||
* @since 1.3
|
* @since 1.3
|
||||||
|
* @deprecated There is no replacement for this class.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(since="24", forRemoval=true)
|
||||||
public class AudioPermission extends BasicPermission {
|
public class AudioPermission extends BasicPermission {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import javax.sound.sampled.AudioPermission;
|
|
||||||
import javax.sound.sampled.AudioSystem;
|
import javax.sound.sampled.AudioSystem;
|
||||||
import javax.sound.sampled.DataLine;
|
import javax.sound.sampled.DataLine;
|
||||||
import javax.sound.sampled.Line;
|
import javax.sound.sampled.Line;
|
||||||
@ -35,18 +34,6 @@ import javax.sound.sampled.SourceDataLine;
|
|||||||
*/
|
*/
|
||||||
public class GetLine {
|
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_PASSED = 0;
|
||||||
static final int STATUS_FAILED = 2;
|
static final int STATUS_FAILED = 2;
|
||||||
static final int STATUS_TEMP = 95;
|
static final int STATUS_TEMP = 95;
|
||||||
@ -80,9 +67,6 @@ public class GetLine {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
l = AudioSystem.getLine(infos[0]);
|
l = AudioSystem.getLine(infos[0]);
|
||||||
} catch(SecurityException lue) {
|
|
||||||
log.println("SecurityException");
|
|
||||||
return STATUS_PASSED;
|
|
||||||
} catch (LineUnavailableException e1) {
|
} catch (LineUnavailableException e1) {
|
||||||
log.println("LUE");
|
log.println("LUE");
|
||||||
return STATUS_PASSED;
|
return STATUS_PASSED;
|
||||||
|
Loading…
Reference in New Issue
Block a user