6968373: FontUtilities static initializer throws AccessControlException
authorigor
Mon, 12 Jul 2010 15:11:20 -0700
changeset 5939 1882d33f2c60
parent 5938 c93e51904f68
child 5940 32cdda425ff6
child 6096 4e1b05a55416
6968373: FontUtilities static initializer throws AccessControlException Reviewed-by: prr
jdk/src/share/classes/sun/font/FontUtilities.java
jdk/test/java/awt/FontClass/FontPrivilege.java
--- a/jdk/src/share/classes/sun/font/FontUtilities.java	Mon Jul 12 13:16:28 2010 -0700
+++ b/jdk/src/share/classes/sun/font/FontUtilities.java	Mon Jul 12 15:11:20 2010 -0700
@@ -60,6 +60,10 @@
 
     static final String LUCIDA_FILE_NAME = "LucidaSansRegular.ttf";
 
+    private static boolean debugFonts = false;
+    private static PlatformLogger logger = null;
+    private static boolean logging;
+
     // This static initializer block figures out the OS constants.
     static {
 
@@ -115,6 +119,25 @@
                 File lucidaFile = new File(jreFontDirName + File.separator
                                            + LUCIDA_FILE_NAME);
                 isOpenJDK = !lucidaFile.exists();
+
+                String debugLevel =
+                    System.getProperty("sun.java2d.debugfonts");
+
+                if (debugLevel != null && !debugLevel.equals("false")) {
+                    debugFonts = true;
+                    logger = PlatformLogger.getLogger("sun.java2d");
+                    if (debugLevel.equals("warning")) {
+                        logger.setLevel(PlatformLogger.WARNING);
+                    } else if (debugLevel.equals("severe")) {
+                        logger.setLevel(PlatformLogger.SEVERE);
+                    }
+                }
+
+                if (debugFonts) {
+                    logger = PlatformLogger.getLogger("sun.java2d");
+                    logging = logger.isEnabled();
+                }
+
                 return null;
             }
         });
@@ -140,32 +163,6 @@
      */
     public static final int MAX_LAYOUT_CHARCODE = 0x206F;
 
-    private static boolean debugFonts = false;
-    private static PlatformLogger logger = null;
-    private static boolean logging;
-
-    static {
-
-        String debugLevel =
-            System.getProperty("sun.java2d.debugfonts");
-
-        if (debugLevel != null && !debugLevel.equals("false")) {
-            debugFonts = true;
-            logger = PlatformLogger.getLogger("sun.java2d");
-            if (debugLevel.equals("warning")) {
-                logger.setLevel(PlatformLogger.WARNING);
-            } else if (debugLevel.equals("severe")) {
-                logger.setLevel(PlatformLogger.SEVERE);
-            }
-        }
-
-        if (debugFonts) {
-            logger = PlatformLogger.getLogger("sun.java2d");
-            logging = logger.isEnabled();
-        }
-
-    }
-
     /**
      * Calls the private getFont2D() method in java.awt.Font objects.
      *
--- a/jdk/test/java/awt/FontClass/FontPrivilege.java	Mon Jul 12 13:16:28 2010 -0700
+++ b/jdk/test/java/awt/FontClass/FontPrivilege.java	Mon Jul 12 15:11:20 2010 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 5010310 6319835 6904882
+ * @bug 5010310 6319835 6904882 6968373
  * @summary test fonts can be created in the presence of a security manager
  * @run main/othervm/secure=java.lang.SecurityManager FontPrivilege
  */