From a62a14d61d78b21230f29519d8d716a9e21aa9e8 Mon Sep 17 00:00:00 2001 From: "norris%netscape.com" Date: Tue, 11 May 1999 16:46:30 +0000 Subject: [PATCH] Subject: Rhino SecurityException patch Date: Tue, 11 May 1999 12:25:50 -0400 From: Andrew Wason To: Norris Boyd Sorry if you aren't the right person to submit Rhino patches to. I couldn't get Rhino to run under JDK1.2 with a SecurityManager installed (e.g. java -Djava.security.manager=java.lang.SecurityManager). I understand the JavaAdapter stuff won't work - but I would still like to use Rhino without that piece. I've attached a small patch which catches and ignores the SecurityExceptions so that Rhino can run with a SecurityManager but without JavaAdapter. Andrew -- Andrew Wason SoftCom, Inc. aw@softcom.com --- js/rhino/org/mozilla/javascript/Context.java | 6 ++++++ js/rhino/src/org/mozilla/javascript/Context.java | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/js/rhino/org/mozilla/javascript/Context.java b/js/rhino/org/mozilla/javascript/Context.java index 2f19de9cdad2..3385e85484c0 100644 --- a/js/rhino/org/mozilla/javascript/Context.java +++ b/js/rhino/org/mozilla/javascript/Context.java @@ -493,6 +493,12 @@ public final class Context { Class adapterClass = Class.forName(adapterName); ScriptableObject.defineClass(scope, adapterClass, sealed); } catch (ClassNotFoundException e) { + } catch (SecurityException e) { + // Ignore AccessControlExceptions that may occur if a + // SecurityManager is installed: + // java.lang.RuntimePermission createClassLoader + // java.util.PropertyPermission + // org.mozilla.javascript.JavaAdapter read } // This creates the Packages and java package roots. diff --git a/js/rhino/src/org/mozilla/javascript/Context.java b/js/rhino/src/org/mozilla/javascript/Context.java index 2f19de9cdad2..3385e85484c0 100644 --- a/js/rhino/src/org/mozilla/javascript/Context.java +++ b/js/rhino/src/org/mozilla/javascript/Context.java @@ -493,6 +493,12 @@ public final class Context { Class adapterClass = Class.forName(adapterName); ScriptableObject.defineClass(scope, adapterClass, sealed); } catch (ClassNotFoundException e) { + } catch (SecurityException e) { + // Ignore AccessControlExceptions that may occur if a + // SecurityManager is installed: + // java.lang.RuntimePermission createClassLoader + // java.util.PropertyPermission + // org.mozilla.javascript.JavaAdapter read } // This creates the Packages and java package roots.