1247 Handle h_context;
1248 if (context != NULL) {
1249 h_context = Handle(THREAD, JNIHandles::resolve(context));
1250 bool authorized = is_authorized(h_context, klass, CHECK_NULL);
1251 if (!authorized) {
1252 // Create an unprivileged access control object and call it's run function
1253 // instead.
1254 oop noprivs = create_dummy_access_control_context(CHECK_NULL);
1255 h_context = Handle(THREAD, noprivs);
1256 }
1257 }
1258
1259 // Check that action object understands "Object run()"
1260 Handle object (THREAD, JNIHandles::resolve(action));
1261
1262 // get run() method
1263 Method* m_oop = object->klass()->uncached_lookup_method(
1264 vmSymbols::run_method_name(),
1265 vmSymbols::void_object_signature(),
1266 Klass::find_overpass);
1267 methodHandle m (THREAD, m_oop);
1268 if (m.is_null() || !m->is_method() || !m()->is_public() || m()->is_static()) {
1269 THROW_MSG_0(vmSymbols::java_lang_InternalError(), "No run method");
1270 }
1271
1272 // Stack allocated list of privileged stack elements
1273 PrivilegedElement pi;
1274 if (!vfst.at_end()) {
1275 pi.initialize(&vfst, h_context(), thread->privileged_stack_top(), CHECK_NULL);
1276 thread->set_privileged_stack_top(&pi);
1277 }
1278
1279
1280 // invoke the Object run() in the action object. We cannot use call_interface here, since the static type
1281 // is not really known - it is either java.security.PrivilegedAction or java.security.PrivilegedExceptionAction
1282 Handle pending_exception;
1283 JavaValue result(T_OBJECT);
1284 JavaCallArguments args(object);
1285 JavaCalls::call(&result, m, &args, THREAD);
1286
1287 // done with action, remove ourselves from the list
1288 if (!vfst.at_end()) {
|
1247 Handle h_context;
1248 if (context != NULL) {
1249 h_context = Handle(THREAD, JNIHandles::resolve(context));
1250 bool authorized = is_authorized(h_context, klass, CHECK_NULL);
1251 if (!authorized) {
1252 // Create an unprivileged access control object and call it's run function
1253 // instead.
1254 oop noprivs = create_dummy_access_control_context(CHECK_NULL);
1255 h_context = Handle(THREAD, noprivs);
1256 }
1257 }
1258
1259 // Check that action object understands "Object run()"
1260 Handle object (THREAD, JNIHandles::resolve(action));
1261
1262 // get run() method
1263 Method* m_oop = object->klass()->uncached_lookup_method(
1264 vmSymbols::run_method_name(),
1265 vmSymbols::void_object_signature(),
1266 Klass::find_overpass);
1267
1268 // See if there is a default method for "Object run()".
1269 if (m_oop == NULL && object->klass()->is_instance_klass()) {
1270 InstanceKlass* iklass = InstanceKlass::cast(object->klass());
1271 m_oop = iklass->lookup_method_in_ordered_interfaces(
1272 vmSymbols::run_method_name(),
1273 vmSymbols::void_object_signature());
1274 }
1275
1276 methodHandle m (THREAD, m_oop);
1277 if (m.is_null() || !m->is_method() || !m()->is_public() || m()->is_static() || m()->is_abstract()) {
1278 THROW_MSG_0(vmSymbols::java_lang_InternalError(), "No run method");
1279 }
1280
1281 // Stack allocated list of privileged stack elements
1282 PrivilegedElement pi;
1283 if (!vfst.at_end()) {
1284 pi.initialize(&vfst, h_context(), thread->privileged_stack_top(), CHECK_NULL);
1285 thread->set_privileged_stack_top(&pi);
1286 }
1287
1288
1289 // invoke the Object run() in the action object. We cannot use call_interface here, since the static type
1290 // is not really known - it is either java.security.PrivilegedAction or java.security.PrivilegedExceptionAction
1291 Handle pending_exception;
1292 JavaValue result(T_OBJECT);
1293 JavaCallArguments args(object);
1294 JavaCalls::call(&result, m, &args, THREAD);
1295
1296 // done with action, remove ourselves from the list
1297 if (!vfst.at_end()) {
|