aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-08-11 06:18:49 +0200
committerSven Gothel <[email protected]>2011-08-11 06:18:49 +0200
commit60da43c2d8a8b229678209276080bf06dc44f0f8 (patch)
tree3c302f258e2705377468f125225930346381e82f /src/jogl/classes/jogamp/graph
parent5cf183b50d0f50d1831a6df1fa2bb70044732358 (diff)
Enclose file IO access in priviledged block
Diffstat (limited to 'src/jogl/classes/jogamp/graph')
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java35
1 files changed, 24 insertions, 11 deletions
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java
index cb0d1a372..126328ad7 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java
@@ -30,6 +30,8 @@ package jogamp.graph.font.typecast;
import java.io.File;
import java.io.IOException;
import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import javax.media.opengl.GLException;
@@ -54,16 +56,27 @@ public class TypecastFontConstructor implements FontConstructor {
return null;
}
- public Font create(URL furl) throws IOException {
- final File tf = File.createTempFile( "joglfont", ".ttf");
- final int len = IOUtil.copyURL2File(furl, tf);
- if(len==0) {
- tf.delete();
- throw new GLException("Font of stream "+furl+" was zero bytes");
- }
- final Font f = create(tf);
- tf.delete();
- return f;
+ public Font create(final URL furl) throws IOException {
+ return (Font) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ File tf = null;
+ int len=0;
+ Font f = null;
+ try {
+ tf = File.createTempFile( "joglfont", ".ttf");
+ len = IOUtil.copyURL2File(furl, tf);
+ if(len==0) {
+ tf.delete();
+ throw new GLException("Font of stream "+furl+" was zero bytes");
+ }
+ f = create(tf);
+ tf.delete();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return f;
+ }
+ });
}
-} \ No newline at end of file
+}