changeset in /hg/icedtea6: 2008-11-10 Omair Majid <omajid at redh...

Omair Majid omajid at redhat.com
Mon Nov 10 10:48:32 PST 2008


changeset 58f7eb173fe0 in /hg/icedtea6
details: http://icedtea.classpath.org/hg/icedtea6?cmd=changeset;node=58f7eb173fe0
description:
	2008-11-10  Omair Majid  <omajid at redhat.com>

	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java
	    (close): Dont check for permission to play audio. Always granted.
	    Infact, checking it causes an AccessControlException for untrusted
	    applets. The ALSA based backend doesnt check this permission at all.
	    (open): Likewise.
	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioMixer.java
	    (getLine): Likewise.
	    (getSourceLines): Likewise.
	    (close): Likewise.
	    (open): Likewise.
	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java
	    (open): Likewise.
	    (close): Likewise.
	    * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetPort.java
	    (open): Likewise.
	    (close): Likewise

diffstat:

5 files changed, 29 insertions(+), 67 deletions(-)
ChangeLog                                                                          |   19 +++++
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java           |    9 --
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioMixer.java          |   38 ----------
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java |   21 ++---
pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetPort.java     |    9 --

diffs (239 lines):

diff -r e7a4c496b2c0 -r 58f7eb173fe0 ChangeLog
--- a/ChangeLog	Mon Nov 10 10:15:16 2008 -0500
+++ b/ChangeLog	Mon Nov 10 13:47:29 2008 -0500
@@ -1,3 +1,22 @@ 2008-11-10  Omair Majid  <omajid at redhat.
+2008-11-10  Omair Majid  <omajid at redhat.com>
+
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java
+	(close): Dont check for permission to play audio. Always granted.
+	Infact, checking it causes an AccessControlException for untrusted
+	applets. The ALSA based backend doesnt check this permission at all.
+	(open): Likewise.
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioMixer.java
+	(getLine): Likewise.
+	(getSourceLines): Likewise.
+	(close): Likewise.
+	(open): Likewise.
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java
+	(open): Likewise.
+	(close): Likewise.
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetPort.java
+	(open): Likewise.
+	(close): Likewise.
+
 2008-11-10  Omair Majid  <omajid at redhat.com>
 
 	* pulseaudio/src/native/org_classpath_icedtea_pulseaudio_EventLoop.c
diff -r e7a4c496b2c0 -r 58f7eb173fe0 pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java
--- a/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java	Mon Nov 10 10:15:16 2008 -0500
+++ b/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java	Mon Nov 10 13:47:29 2008 -0500
@@ -41,7 +41,6 @@ import java.io.IOException;
 
 import javax.sound.sampled.AudioFormat;
 import javax.sound.sampled.AudioInputStream;
-import javax.sound.sampled.AudioPermission;
 import javax.sound.sampled.AudioSystem;
 import javax.sound.sampled.Clip;
 import javax.sound.sampled.DataLine;
@@ -231,10 +230,6 @@ public class PulseAudioClip extends Puls
 	@Override
 	public void close() {
 
-		/* check for permission to play audio */
-		AudioPermission perm = new AudioPermission("play", null);
-		perm.checkGuard(null);
-
 		if (!isOpen) {
 			throw new IllegalStateException("line already closed");
 		}
@@ -396,10 +391,6 @@ public class PulseAudioClip extends Puls
 	@Override
 	public void open(AudioFormat format, byte[] data, int offset, int bufferSize)
 			throws LineUnavailableException {
-
-		/* check for permission to play audio */
-		AudioPermission perm = new AudioPermission("play", null);
-		perm.checkGuard(null);
 
 		super.open(format);
 		this.data = new byte[bufferSize];
diff -r e7a4c496b2c0 -r 58f7eb173fe0 pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioMixer.java
--- a/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioMixer.java	Mon Nov 10 10:15:16 2008 -0500
+++ b/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioMixer.java	Mon Nov 10 13:47:29 2008 -0500
@@ -298,15 +298,11 @@ public class PulseAudioMixer implements 
 		}
 
 		if ((info.getLineClass() == SourceDataLine.class)) {
-			/* check for permission to play audio */
-			AudioPermission perm = new AudioPermission("play", null);
-			perm.checkGuard(null);
-
 			return new PulseAudioSourceDataLine(formats, defaultFormat);
 		}
 
 		if ((info.getLineClass() == TargetDataLine.class)) {
-			/* check for permission to play audio */
+			/* check for permission to record audio */
 			AudioPermission perm = new AudioPermission("record", null);
 			perm.checkGuard(null);
 
@@ -314,10 +310,6 @@ public class PulseAudioMixer implements 
 		}
 
 		if ((info.getLineClass() == Clip.class)) {
-			/* check for permission to play audio */
-			AudioPermission perm = new AudioPermission("play", null);
-			perm.checkGuard(null);
-
 			return new PulseAudioClip(formats, defaultFormat);
 		}
 
@@ -371,11 +363,6 @@ public class PulseAudioMixer implements 
 
 	@Override
 	public Line[] getSourceLines() {
-
-		/* check for permmission to play audio */
-		AudioPermission perm = new AudioPermission("play", null);
-		perm.checkGuard(null);
-
 		return (Line[]) sourceLines.toArray(new Line[0]);
 
 	}
@@ -401,7 +388,7 @@ public class PulseAudioMixer implements 
 	@Override
 	public Line[] getTargetLines() {
 
-		/* check for permission to play audio */
+		/* check for permission to record audio */
 		AudioPermission perm = new AudioPermission("record", null);
 		perm.checkGuard(null);
 
@@ -492,16 +479,6 @@ public class PulseAudioMixer implements 
 		 * is allowed
 		 */
 
-		try {
-			/* check for permission to play audio */
-			AudioPermission perm = new AudioPermission("play", null);
-			perm.checkGuard(null);
-		} catch (SecurityException e) {
-			/* check for permission to record audio */
-			AudioPermission perm = new AudioPermission("record", null);
-			perm.checkGuard(null);
-		}
-
 		if (!this.isOpen) {
 			throw new IllegalStateException("Mixer is not open; cant close");
 		}
@@ -616,16 +593,6 @@ public class PulseAudioMixer implements 
 		 * only allow the mixer to be controlled if either playback or recording
 		 * is allowed
 		 */
-
-		try {
-			/* check for permission to play audio */
-			AudioPermission perm = new AudioPermission("play", null);
-			perm.checkGuard(null);
-		} catch (SecurityException e) {
-			/* check for permission to record audio */
-			AudioPermission perm = new AudioPermission("record", null);
-			perm.checkGuard(null);
-		}
 
 		if (isOpen) {
 			throw new IllegalStateException("Mixer is already open");
@@ -738,7 +705,6 @@ public class PulseAudioMixer implements 
 	 * Cons: - eventListeners are run from other threads, if those then call
 	 * fireEvent while a method is waiting on a listener, this synchronized
 	 * block wont be entered: deadlock!
-	 * 
 	 */
 	private void fireEvent(final LineEvent e) {
 		synchronized (lineListeners) {
diff -r e7a4c496b2c0 -r 58f7eb173fe0 pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java
--- a/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java	Mon Nov 10 10:15:16 2008 -0500
+++ b/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java	Mon Nov 10 13:47:29 2008 -0500
@@ -68,10 +68,6 @@ public class PulseAudioSourceDataLine ex
 	synchronized public void open(AudioFormat format, int bufferSize)
 			throws LineUnavailableException {
 
-		/* check for permission to play audio */
-		AudioPermission perm = new AudioPermission("play", null);
-		perm.checkGuard(null);
-
 		super.open(format, bufferSize);
 
 		volumeControl = new PulseAudioVolumeControl(this, eventLoop);
@@ -154,11 +150,14 @@ public class PulseAudioSourceDataLine ex
 		}
 
 		if (offset < 0) {
-			throw new ArrayIndexOutOfBoundsException("offset is negative: " + offset);
-		}
-		
+			throw new ArrayIndexOutOfBoundsException("offset is negative: "
+					+ offset);
+		}
+
 		if (length + offset > data.length) {
-			throw new ArrayIndexOutOfBoundsException("writing data beyond the length of the array: " + (length + offset));
+			throw new ArrayIndexOutOfBoundsException(
+					"writing data beyond the length of the array: "
+							+ (length + offset));
 		}
 
 		int position = offset;
@@ -318,10 +317,6 @@ public class PulseAudioSourceDataLine ex
 	@Override
 	synchronized public void close() {
 
-		/* check for permmission to play audio */
-		AudioPermission perm = new AudioPermission("play", null);
-		perm.checkGuard(null);
-
 		if (!isOpen) {
 			throw new IllegalStateException("not open so cant close");
 		}
@@ -333,7 +328,7 @@ public class PulseAudioSourceDataLine ex
 
 		super.close();
 	}
-	
+
 	public javax.sound.sampled.Line.Info getLineInfo() {
 		return new DataLine.Info(SourceDataLine.class, supportedFormats,
 				StreamBufferAttributes.MIN_VALUE,
diff -r e7a4c496b2c0 -r 58f7eb173fe0 pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetPort.java
--- a/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetPort.java	Mon Nov 10 10:15:16 2008 -0500
+++ b/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetPort.java	Mon Nov 10 13:47:29 2008 -0500
@@ -37,7 +37,6 @@ exception statement from your version.
 
 package org.classpath.icedtea.pulseaudio;
 
-import javax.sound.sampled.AudioPermission;
 import javax.sound.sampled.Port;
 
 public class PulseAudioTargetPort extends PulseAudioPort {
@@ -55,10 +54,6 @@ public class PulseAudioTargetPort extend
 
 	public void open() {
 
-		/* check for permission to play audio */
-		AudioPermission perm = new AudioPermission("play", null);
-		perm.checkGuard(null);
-
 		super.open();
 
 		PulseAudioMixer parent = PulseAudioMixer.getInstance();
@@ -66,10 +61,6 @@ public class PulseAudioTargetPort extend
 	}
 
 	public void close() {
-
-		/* check for permission to play audio */
-		AudioPermission perm = new AudioPermission("play", null);
-		perm.checkGuard(null);
 
 		if (!isOpen) {
 			throw new IllegalStateException("not open, so cant close Port");



More information about the distro-pkg-dev mailing list