List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:November 26 2007 9:34am
Subject:Rev 302: Fixed bug where passing a null to setString barfed. 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: 302
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: devel
timestamp: Mon 2007-11-26 01:34:28 -0800
message:
  Fixed bug where passing a null to setString barfed. 
modified:
  java/ndbj.i                    ndbj.i-20070913223244-5938mztpztyn9sry-1
=== modified file 'java/ndbj.i'
--- a/java/ndbj.i	2007-11-26 08:55:30 +0000
+++ b/java/ndbj.i	2007-11-26 09:34:28 +0000
@@ -263,13 +263,19 @@
 
 %typemap(in) (const char* anInputString, size_t len) {
   /* Check that we are getting a string */
-  $1 = (char *)(jenv->GetStringUTFChars($input,0));
-  $2 = jenv->GetStringUTFLength($input);
+  if ($input==NULL) { 
+    $1 = "";
+    $2 = 0;
+  } else { 
+    $1 = (char *)(jenv->GetStringUTFChars($input,0));
+    $2 = jenv->GetStringUTFLength($input);
+  }
  }
 
 %typemap(freearg) (const char * anInputString, size_t len) { 
   if ($1) { 
-    jenv->ReleaseStringUTFChars($input,$1); 
+    if ($1 != "") 
+      jenv->ReleaseStringUTFChars($input,$1); 
   }
  }
 

Thread
Rev 302: Fixed bug where passing a null to setString barfed. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/develMonty Taylor26 Nov