jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java
changeset 548 caed182cee6e
parent 2 90ce3da70b43
child 550 e85f91b9bb95
--- a/jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java	Mon Apr 28 09:59:35 2008 -0700
+++ b/jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java	Mon Apr 28 11:06:18 2008 -0700
@@ -296,7 +296,7 @@
     }
 
     public static void registerJREFontsForPrinting() {
-        String pathName = null;
+        final String pathName;
         synchronized (Win32GraphicsEnvironment.class) {
             GraphicsEnvironment.getLocalGraphicsEnvironment();
             if (fontsForPrinting == null) {
@@ -305,15 +305,21 @@
             pathName = fontsForPrinting;
             fontsForPrinting = null;
         }
-        File f1 = new File(pathName);
-        String[] ls = f1.list(new TTFilter());
-        if (ls == null) {
-          return;
-        }
-        for (int i=0; i <ls.length; i++ ) {
-          File fontFile = new File(f1, ls[i]);
-          registerFontWithPlatform(fontFile.getAbsolutePath());
-        }
+        java.security.AccessController.doPrivileged(
+            new java.security.PrivilegedAction() {
+                public Object run() {
+                    File f1 = new File(pathName);
+                    String[] ls = f1.list(new TTFilter());
+                    if (ls == null) {
+                        return null;
+                    }
+                    for (int i=0; i <ls.length; i++ ) {
+                        File fontFile = new File(f1, ls[i]);
+                        registerFontWithPlatform(fontFile.getAbsolutePath());
+                    }
+                    return null;
+                }
+         });
     }
 
     protected static native void registerFontWithPlatform(String fontName);