Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit 5cc74502e62d99d40f5c7a841a57fafde5e7ed33 1 parent 8a7b9fd
Andy McFadden fadden authored

Showing 3 changed files with 12 additions and 2 deletions. Show diff stats Hide diff stats

  1. +9 0 vm/Exception.cpp
  2. +1 0  vm/Exception.h
  3. +2 2 vm/Native.cpp
9 vm/Exception.cpp
@@ -1430,6 +1430,15 @@ void dvmThrowUnsatisfiedLinkError(const char* msg) {
1430 1430 dvmThrowException(gDvm.exUnsatisfiedLinkError, msg);
1431 1431 }
1432 1432
  1433 +void dvmThrowUnsatisfiedLinkError(const char* msg, const Method* method) {
  1434 + char* desc = dexProtoCopyMethodDescriptor(&method->prototype);
  1435 + char* className = dvmDescriptorToDot(method->clazz->descriptor);
  1436 + dvmThrowExceptionFmt(gDvm.exUnsatisfiedLinkError, "%s: %s.%s:%s",
  1437 + msg, className, method->name, desc);
  1438 + free(className);
  1439 + free(desc);
  1440 +}
  1441 +
1433 1442 void dvmThrowUnsupportedOperationException(const char* msg) {
1434 1443 dvmThrowException(gDvm.exUnsupportedOperationException, msg);
1435 1444 }
1  vm/Exception.h
@@ -463,6 +463,7 @@ void dvmThrowTypeNotPresentException(const char* descriptor);
463 463 * the given detail message.
464 464 */
465 465 void dvmThrowUnsatisfiedLinkError(const char* msg);
  466 +void dvmThrowUnsatisfiedLinkError(const char* msg, const Method* method);
466 467
467 468 /**
468 469 * Throw an UnsupportedOperationException in the current thread, with
4 vm/Native.cpp
@@ -118,12 +118,12 @@ void dvmResolveNativeMethod(const u4* args, JValue* pResult,
118 118
119 119 IF_ALOGW() {
120 120 char* desc = dexProtoCopyMethodDescriptor(&method->prototype);
121   - ALOGW("No implementation found for native %s.%s %s",
  121 + ALOGW("No implementation found for native %s.%s:%s",
122 122 clazz->descriptor, method->name, desc);
123 123 free(desc);
124 124 }
125 125
126   - dvmThrowUnsatisfiedLinkError(method->name);
  126 + dvmThrowUnsatisfiedLinkError("Native method not found", method);
127 127 }
128 128
129 129

0 comments on commit 5cc7450

Please sign in to comment.
Something went wrong with that request. Please try again.