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
diff --git a/vm/Exception.cpp b/vm/Exception.cpp
index 8dbec39..de6d9a9 100644
--- a/vm/Exception.cpp
+++ b/vm/Exception.cpp
@@ -1430,6 +1430,15 @@
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);
}
diff --git a/vm/Exception.h b/vm/Exception.h
index 3b7bdd9..055ed2b 100644
--- a/vm/Exception.h
+++ b/vm/Exception.h
@@ -463,6 +463,7 @@
* 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
diff --git a/vm/Native.cpp b/vm/Native.cpp
index 6ccd1ea..be719a7 100644
--- a/vm/Native.cpp
+++ b/vm/Native.cpp
@@ -118,12 +118,12 @@
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);
}