summaryrefslogtreecommitdiff
path: root/sandbox
diff options
context:
space:
mode:
authorJoachim Lingner <jl@openoffice.org>2002-10-08 06:59:48 +0000
committerJoachim Lingner <jl@openoffice.org>2002-10-08 06:59:48 +0000
commiteb15f7d7bddd1647a764dc4d51e8cb404bae2662 (patch)
tree8e0b9078693b89b9c7a0aa9d3664b0837d575a32 /sandbox
parente7691a68241e421a1727fc11eee1dd35ec9790c1 (diff)
#104030# using a PriviligedAction when creating sun.applet.AudioClip and other classes from sun. package
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/com/sun/star/lib/sandbox/ResourceImpl.java40
1 files changed, 28 insertions, 12 deletions
diff --git a/sandbox/com/sun/star/lib/sandbox/ResourceImpl.java b/sandbox/com/sun/star/lib/sandbox/ResourceImpl.java
index a809aa964958..4cbf7cabc00d 100644
--- a/sandbox/com/sun/star/lib/sandbox/ResourceImpl.java
+++ b/sandbox/com/sun/star/lib/sandbox/ResourceImpl.java
@@ -2,9 +2,9 @@
*
* $RCSfile: ResourceImpl.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: kr $ $Date: 2001-03-13 09:31:04 $
+ * last change: $Author: jl $ $Date: 2002-10-08 07:59:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -76,6 +76,8 @@ import java.net.MalformedURLException;
import java.util.Enumeration;
import java.util.Vector;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import sun.awt.image.ByteArrayImageSource;
import sun.awt.image.URLImageSource;
@@ -182,11 +184,18 @@ class ResourceImpl implements Resource {
if(object != null)
imageProducer = (ImageProducer)object;
else {
- if(bytes != null)
- imageProducer = new ByteArrayImageSource(bytes, 0, bytes.length);
- else
- imageProducer = new URLImageSource(url);
-
+ // we use a PrivilegedAction here because otherwise the system classloader
+ // will call our SecurityManager's checkPackageAccess method which will
+ // refuse to access sun.* packages and hence ByteArrayInputStream and
+ // URLImageSource
+ imageProducer= (ImageProducer)
+ AccessController.doPrivileged( new PrivilegedAction() {
+ public Object run() {
+ if(bytes != null)
+ return new ByteArrayImageSource(bytes, 0, bytes.length);
+ else
+ return new URLImageSource(url);
+ }});
object = imageProducer;
}
@@ -199,11 +208,18 @@ class ResourceImpl implements Resource {
if(object != null)
audioClip = (AudioClip)object;
else {
- if(bytes != null)
- audioClip = new AppletAudioClip(bytes);
- else
- audioClip = new AppletAudioClip(url);
-
+ // we use a PrivilegedAction here because otherwise the system classloader
+ // will call our SecurityManager's checkPackageAccess method which will
+ // refuse to access sun.* packages and hence AppletAudioClip
+ audioClip= (AppletAudioClip)
+ AccessController.doPrivileged( new PrivilegedAction() {
+ public Object run() {
+ if(bytes != null)
+ return new AppletAudioClip(bytes);
+ else
+ return new AppletAudioClip(url);
+ }
+ });
object = audioClip;
}