List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:November 24 2007 4:27am
Subject:Rev 285: Added full path named exceptions to both exception methods. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/devel
View as plain text  
At http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/devel

------------------------------------------------------------
revno: 285
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: devel
timestamp: Fri 2007-11-23 20:25:00 -0800
message:
  Added full path named exceptions to both exception methods.
modified:
  java/ndbj.i                    ndbj.i-20070913223244-5938mztpztyn9sry-1
=== modified file 'java/ndbj.i'
--- a/java/ndbj.i	2007-11-24 04:14:32 +0000
+++ b/java/ndbj.i	2007-11-24 04:25:00 +0000
@@ -84,14 +84,19 @@
 #define NDB_exception_err(excp, msg, err) { ndb_throw_exception(jenv, #excp,msg, err);  }

 
 void ndb_throw_exception(JNIEnv *jenv, const char * excp, const char *msg) { 
+  jclass clazz = NULL;
   const char * prefix = "com/mysql/cluster/ndbj/";
-  char * exception = (char *)malloc(strlen(excp)+strlen(prefix)+1);
-  strcpy(exception,prefix);
-  strcat(exception,excp);
+  if (strncmp(excp,"com.",4)) {
+    clazz = jenv->FindClass(excp);
+  } else { 
+    char * exception = (char *)malloc(strlen(excp)+strlen(prefix)+1);
+    strcpy(exception,prefix);
+    strcat(exception,excp);
 
-  //jclass clazz = jenv->FindClass("java/lang/RuntimeException");
-  jclass clazz = jenv->FindClass(exception);
-  free(exception);
+    //jclass clazz = jenv->FindClass("java/lang/RuntimeException");
+    jclass clazz = jenv->FindClass(exception);
+    free(exception);
+  }
 
   jenv->ThrowNew(clazz,msg);
   jenv->DeleteLocalRef(clazz);

Thread
Rev 285: Added full path named exceptions to both exception methods. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/develMonty Taylor24 Nov