Fix bug 392825 - ClassShutter doesn't prevent access through Java reflection

APIs


git-svn-id: svn://10.0.0.236/trunk@232358 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
nboyd%atg.com
2007-08-20 00:30:05 +00:00
parent 236245a177
commit 457de4428e
2 changed files with 11 additions and 2 deletions

View File

@@ -62,9 +62,15 @@ class JavaMembers
{
this(scope, cl, false);
}
JavaMembers(Scriptable scope, Class cl, boolean includeProtected)
{
Context cx = Context.getContext();
ClassShutter shutter = cx.getClassShutter();
if (shutter != null && !shutter.visibleToScripts(cl.getName())) {
throw Context.reportRuntimeError1("msg.access.prohibited",
cl.getName());
}
this.members = new Hashtable(23);
this.staticMembers = new Hashtable(7);
this.cl = cl;

View File

@@ -699,6 +699,9 @@ msg.java.array.index.out.of.bounds =\
msg.pkg.int =\
Java package names may not be numbers.
msg.access.prohibited =\
Access to Java class "{0}" is prohibited.
# ImporterTopLevel
msg.ambig.import =\
Ambiguous import: "{0}" and and "{1}".
@@ -710,7 +713,7 @@ msg.not.class =\
Function importClass must be called with a class; had "{0}" instead.
msg.not.class.not.pkg =\
"{0}" is neither a class nor a package.
"{0}" is neither a class nor a package.
msg.prop.defined =\
Cannot import "{0}" since a property by that name is already defined.