6968373: FontUtilities static initializer throws AccessControlException

Reviewed-by: prr
This commit is contained in:
Igor Nekrestyanov 2010-07-12 15:11:20 -07:00
parent 37f89e6be6
commit 9ab742ede8
2 changed files with 24 additions and 27 deletions

View File

@ -60,6 +60,10 @@ public final class FontUtilities {
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 @@ public final class FontUtilities {
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 final class FontUtilities {
*/
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.
*

View File

@ -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
*/