From be79905366c94c784089d1a0108fc81bef11474c Mon Sep 17 00:00:00 2001 From: ishmal Date: Wed, 12 Mar 2008 20:05:45 +0000 Subject: [PATCH] Split getException into method and function, so it can be used in native functions. --- src/bind/dobinding.cpp | 8 ++++++-- src/bind/javabind-private.h | 3 --- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/bind/dobinding.cpp b/src/bind/dobinding.cpp index e2157de0b..639e27062 100644 --- a/src/bind/dobinding.cpp +++ b/src/bind/dobinding.cpp @@ -66,6 +66,10 @@ typedef struct JNINativeMethod *methods; } NativeClass; +/** + * Although I dislike macros, this one seems reasonable + */ +#define EXCEPTION (getExceptionString(env).c_str()) //######################################################################## //# BASE OBJECT @@ -76,7 +80,7 @@ static jlong getPointer(JNIEnv *env, jobject obj) jfieldID id = env->GetFieldID(env->GetObjectClass(obj), "_pointer", "J"); if (!id) { - err("getPointer: %s", getException(env).c_str()); + err("getPointer: %s", EXCEPTION); return 0; } jlong val = env->GetLongField(obj, id); @@ -88,7 +92,7 @@ static void setPointer(JNIEnv *env, jobject obj, jlong val) jfieldID id = env->GetFieldID(env->GetObjectClass(obj), "_pointer", "J"); if (!id) { - err("setPointer: %s", getException(env).c_str()); + err("setPointer: %s", EXCEPTION); return; } env->SetLongField(obj, id, val); diff --git a/src/bind/javabind-private.h b/src/bind/javabind-private.h index c4dbd5e9a..c919c105d 100644 --- a/src/bind/javabind-private.h +++ b/src/bind/javabind-private.h @@ -95,9 +95,6 @@ String normalizePath(const String &str); String getExceptionString(JNIEnv *env); -String getException(JNIEnv *env) - { return getExceptionString(env); } - jint getInt(JNIEnv *env, jobject obj, const char *name); void setInt(JNIEnv *env, jobject obj, const char *name, jint val); -- 2.30.2