Permalink
Browse files

Tweak UnsatisfiedLinkError

Change this:

  java.lang.UnsatisfiedLinkError: getSuperclass

to this:

  java.lang.UnsatisfiedLinkError: Native method not found:
    java.lang.Class.getSuperclass:()Ljava/lang/Class;

Change-Id: I23bd4350caf743ad9ba3524da0a10107c63af56a
  • Loading branch information...
1 parent 8a7b9fd commit 5cc74502e62d99d40f5c7a841a57fafde5e7ed33 @fadden fadden committed Jan 20, 2012
Showing with 12 additions and 2 deletions.
  1. +9 −0 vm/Exception.cpp
  2. +1 −0 vm/Exception.h
  3. +2 −2 vm/Native.cpp
View
@@ -1430,6 +1430,15 @@ void dvmThrowUnsatisfiedLinkError(const char* msg) {
dvmThrowException(gDvm.exUnsatisfiedLinkError, msg);
}
+void dvmThrowUnsatisfiedLinkError(const char* msg, const Method* method) {
+ char* desc = dexProtoCopyMethodDescriptor(&method->prototype);
+ char* className = dvmDescriptorToDot(method->clazz->descriptor);
+ dvmThrowExceptionFmt(gDvm.exUnsatisfiedLinkError, "%s: %s.%s:%s",
+ msg, className, method->name, desc);
+ free(className);
+ free(desc);
+}
+
void dvmThrowUnsupportedOperationException(const char* msg) {
dvmThrowException(gDvm.exUnsupportedOperationException, msg);
}
View
@@ -463,6 +463,7 @@ void dvmThrowTypeNotPresentException(const char* descriptor);
* the given detail message.
*/
void dvmThrowUnsatisfiedLinkError(const char* msg);
+void dvmThrowUnsatisfiedLinkError(const char* msg, const Method* method);
/**
* Throw an UnsupportedOperationException in the current thread, with
View
@@ -118,12 +118,12 @@ void dvmResolveNativeMethod(const u4* args, JValue* pResult,
IF_ALOGW() {
char* desc = dexProtoCopyMethodDescriptor(&method->prototype);
- ALOGW("No implementation found for native %s.%s %s",
+ ALOGW("No implementation found for native %s.%s:%s",
clazz->descriptor, method->name, desc);
free(desc);
}
- dvmThrowUnsatisfiedLinkError(method->name);
+ dvmThrowUnsatisfiedLinkError("Native method not found", method);
}

0 comments on commit 5cc7450

Please sign in to comment.