BootClassLoader.java (getBootURLLoader): New method.
2007-04-16 Andrew Haley <aph@redhat.com> * gnu/gcj/runtime/BootClassLoader.java (getBootURLLoader): New method. (bootGetResource): Use getBootURLLoader() to load resources. (bootGetResources): Likewise. * java/lang/reflect/natMethod.cc (Method::invoke): In invoke also check that the method's declaring class is accessible. From-SVN: r123862
This commit is contained in:
parent
60555ced95
commit
0e055c1cd2
3 changed files with 93 additions and 7 deletions
|
@ -173,16 +173,34 @@ java::lang::reflect::Method::invoke (jobject obj, jobjectArray args)
|
|||
}
|
||||
|
||||
// Check accessibility, if required.
|
||||
if (! (Modifier::isPublic (meth->accflags) || this->isAccessible()))
|
||||
if (! this->isAccessible())
|
||||
{
|
||||
Class *caller = _Jv_StackTrace::GetCallingClass (&Method::class$);
|
||||
if (! _Jv_CheckAccess(caller, declaringClass, meth->accflags))
|
||||
throw new IllegalAccessException;
|
||||
if (! (Modifier::isPublic (meth->accflags)))
|
||||
{
|
||||
Class *caller = _Jv_StackTrace::GetCallingClass (&Method::class$);
|
||||
if (! _Jv_CheckAccess(caller, declaringClass, meth->accflags))
|
||||
throw new IllegalAccessException;
|
||||
}
|
||||
else
|
||||
// Method is public, check to see if class is accessible.
|
||||
{
|
||||
jint flags = (declaringClass->accflags
|
||||
& (Modifier::PUBLIC
|
||||
| Modifier::PROTECTED
|
||||
| Modifier::PRIVATE));
|
||||
if (flags == 0) // i.e. class is package private
|
||||
{
|
||||
Class *caller = _Jv_StackTrace::GetCallingClass (&Method::class$);
|
||||
if (! _Jv_ClassNameSamePackage (caller->name,
|
||||
declaringClass->name))
|
||||
throw new IllegalAccessException;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (declaringClass->isInterface())
|
||||
iface = declaringClass;
|
||||
|
||||
|
||||
return _Jv_CallAnyMethodA (obj, return_type, meth, false,
|
||||
parameter_types, args, iface);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue