aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/share/javax
diff options
context:
space:
mode:
authorKevin Rushforth <[email protected]>2007-04-17 16:59:56 +0000
committerKevin Rushforth <[email protected]>2007-04-17 16:59:56 +0000
commit63d45cec25f84ba279c03e50eb10fdc545ec452f (patch)
treecda65539c7d33716de0e878a32c34d5799ff6c49 /src/classes/share/javax
parenta94b5e885413be57d39b6c0e5f65a5917558b7dc (diff)
Fixed SecurityException when running applets & Web Start applications caused
by the fix for issue 293. git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@823 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src/classes/share/javax')
-rw-r--r--src/classes/share/javax/media/j3d/MasterControl.java47
1 files changed, 33 insertions, 14 deletions
diff --git a/src/classes/share/javax/media/j3d/MasterControl.java b/src/classes/share/javax/media/j3d/MasterControl.java
index 95d6489..c0b1ae6 100644
--- a/src/classes/share/javax/media/j3d/MasterControl.java
+++ b/src/classes/share/javax/media/j3d/MasterControl.java
@@ -706,27 +706,42 @@ class MasterControl {
canvasFreeIndex = 0;
}
- private static Logger createLogger(String loggerName, Level defaultLevel) {
- Logger logger = Logger.getLogger(loggerName);
+ private static boolean initLogger(Logger logger, Level defaultLevel) {
+ if (logger == null) {
+ return false;
+ }
- if (defaultLevel != null && logger.getLevel() == null &&
- logger.getLogger("j3d").getLevel() == null) {
+ if (defaultLevel != null &&
+ logger.getLevel() == null &&
+ Logger.getLogger("j3d").getLevel() == null) {
- // Set default logger level rather than inheriting from system global
- logger.setLevel(defaultLevel);
+ try {
+ // Set default logger level rather than inheriting from system global
+ logger.setLevel(defaultLevel);
+ } catch (SecurityException ex) {
+ System.err.println(ex);
+ return false;
+ }
}
- return logger;
+ return logger.isLoggable(Level.SEVERE);
}
// Called by the static initializer to initialize the loggers
private static void initLoggers() {
- devLogger = createLogger("j3d.developer", Level.OFF);
- devLoggerEnabled = devLogger.isLoggable(Level.SEVERE);
- statsLogger = createLogger("j3d.stats", Level.OFF);
- statsLoggerEnabled = statsLogger.isLoggable(Level.SEVERE);
- coreLogger = createLogger("j3d.core", null);
- coreLoggerEnabled = coreLogger.isLoggable(Level.SEVERE);
+ coreLogger = Logger.getLogger("j3d.core");
+ devLogger = Logger.getLogger("j3d.developer");
+ statsLogger = Logger.getLogger("j3d.stats");
+
+ java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction() {
+ public Object run() {
+ coreLoggerEnabled = initLogger(coreLogger, null);
+ devLoggerEnabled = initLogger(devLogger, Level.OFF);
+ statsLoggerEnabled = initLogger(statsLogger, Level.OFF);
+ return null;
+ }
+ });
}
/**
@@ -3647,7 +3662,11 @@ class MasterControl {
});
// Initialize loggers
- initLoggers();
+ try {
+ initLoggers();
+ } catch (RuntimeException ex) {
+ System.err.println(ex);
+ }
}