JNI Convenience: Print exceptions in debug mode.

The exception message might contain valuable information about what went
wrong, so we should print the message.

Change-Id: I50c986d4c18cf6115017fcc92363c946be45024d
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
This commit is contained in:
Christian Strømme 2013-08-16 11:31:26 +02:00 committed by The Qt Project
parent 1db13907d9
commit ca0ec4043f

View File

@ -57,6 +57,9 @@ static jclass getCachedClass(JNIEnv *env, const char *className)
jclass c = env->FindClass(className);
if (env->ExceptionCheck()) {
c = 0;
#ifdef QT_DEBUG
env->ExceptionDescribe();
#endif // QT_DEBUG
env->ExceptionClear();
}
if (c)
@ -88,6 +91,9 @@ static jmethodID getCachedMethodID(JNIEnv *env,
if (env->ExceptionCheck()) {
id = 0;
#ifdef QT_DEBUG
env->ExceptionDescribe();
#endif // QT_DEBUG
env->ExceptionClear();
}
@ -117,6 +123,9 @@ static jfieldID getCachedFieldID(JNIEnv *env,
if (env->ExceptionCheck()) {
id = 0;
#ifdef QT_DEBUG
env->ExceptionDescribe();
#endif // QT_DEBUG
env->ExceptionClear();
}