diff options
| author | 2011-09-22 17:16:54 -0700 | |
|---|---|---|
| committer | 2011-09-23 17:11:55 -0700 | |
| commit | bc2f3e3e41d02eb2896dc16390c5c4023a7b5649 (patch) | |
| tree | 1f229465f28c2178a7fe849e45bc2fd91d3dab4a /src | |
| parent | 21d9e8323124a832a21679ca83808bc9c68ed365 (diff) | |
Add support for oat_process for use as a wrap.* launcher
Add test support for running Calculator
Change-Id: I7ec0681febe6f6c836452e8afb4c12a2ebfa0ea8
Diffstat (limited to 'src')
| -rw-r--r-- | src/java_lang_Class.cc | 9 | ||||
| -rw-r--r-- | src/thread.cc | 9 |
2 files changed, 8 insertions, 10 deletions
diff --git a/src/java_lang_Class.cc b/src/java_lang_Class.cc index ec0b0edf15..c334f046e5 100644 --- a/src/java_lang_Class.cc +++ b/src/java_lang_Class.cc @@ -227,13 +227,6 @@ jboolean Class_isPrimitive(JNIEnv* env, jobject javaThis) { return c->IsPrimitive(); } -bool CheckClassAccess(const Class* access_from, const Class* klass) { - if (klass->IsPublic()) { - return true; - } - return access_from->IsInSamePackage(klass); -} - // Validate method/field access. bool CheckMemberAccess(const Class* access_from, const Class* access_to, uint32_t member_flags) { // quick accept for public access */ @@ -293,7 +286,7 @@ jobject Class_newInstanceImpl(JNIEnv* env, jobject javaThis) { Method* caller_caller = frame.GetMethod(); Class* caller_class = caller_caller->GetDeclaringClass(); - if (!CheckClassAccess(c, caller_class)) { + if (!caller_class->CanAccess(c)) { Thread::Current()->ThrowNewException("Ljava/lang/IllegalAccessException;", "Class %s is not accessible from class %s", PrettyDescriptor(c->GetDescriptor()).c_str(), diff --git a/src/thread.cc b/src/thread.cc index 22495be9c2..800507201b 100644 --- a/src/thread.cc +++ b/src/thread.cc @@ -301,7 +301,7 @@ void LockObjectFromCode(Thread* thread, Object* obj) { obj->MonitorEnter(thread); DCHECK(thread->HoldsLock(obj)); // Only possible exception is NPE and is handled before entry - DCHECK(thread->GetException() == NULL); + DCHECK(!thread->IsExceptionPending()); } extern "C" void artCheckSuspendFromCode(Thread* thread) { @@ -358,10 +358,14 @@ extern "C" uint64_t artFindInterfaceMethodInCacheFromCode(uint32_t method_idx, Method* interface_method = class_linker->ResolveMethod(method_idx, caller_method, false); if (interface_method == NULL) { // Could not resolve interface method. Throw error and unwind - CHECK(thread->GetException() != NULL); + CHECK(thread->IsExceptionPending()); return 0; } Method* method = this_object->GetClass()->FindVirtualMethodForInterface(interface_method); + if (method == NULL) { + CHECK(thread->IsExceptionPending()); + return 0; + } const void* code = method->GetCode(); uint32_t method_uint = reinterpret_cast<uint32_t>(method); @@ -1372,6 +1376,7 @@ void Thread::ThrowNewExceptionV(const char* exception_class_descriptor, const ch CHECK(exception_class != NULL) << "descriptor=\"" << descriptor << "\""; int rc = env->ThrowNew(exception_class, msg.c_str()); CHECK_EQ(rc, JNI_OK); + env->DeleteLocalRef(exception_class); } void Thread::ThrowOutOfMemoryError() { |