=== modified file 'java/Makefile.am'
--- a/java/Makefile.am	2008-05-05 23:35:20 +0000
+++ b/java/Makefile.am	2008-05-20 18:32:59 +0000
@@ -223,7 +223,7 @@
 	${srcdir}/testsuite/ndbj/NdbScanTest.java \
 	${srcdir}/testsuite/ndbj/NullSetTest.java \
 	${srcdir}/testsuite/ndbj/OrderedIndexScanTest.java \
-	${srcdir}/testsuite/ndbj/QuickAsyncTest.java \
+	${srcdir}/testsuite/ndbj/AsyncTest.java \
 	${srcdir}/testsuite/ndbj/QuickBFTest.java \
 	${srcdir}/testsuite/ndbj/SelectCountTest.java \
 	${srcdir}/testsuite/ndbj/Utf8InsertReadTest.java \
@@ -313,7 +313,7 @@
 	${builddir}/testsuite/ndbj/NdbScanTest.class \
 	${builddir}/testsuite/ndbj/NullSetTest.class \
 	${builddir}/testsuite/ndbj/OrderedIndexScanTest.class \
-	${builddir}/testsuite/ndbj/QuickAsyncTest.class \
+	${builddir}/testsuite/ndbj/AsyncTest.class \
 	${builddir}/testsuite/ndbj/QuickBFTest.class \
 	${builddir}/testsuite/ndbj/SelectCountTest.class \
 	${builddir}/testsuite/ndbj/Utf8InsertReadTest.class \

=== modified file 'java/ndbj.i'
--- a/java/ndbj.i	2008-05-08 16:10:25 +0000
+++ b/java/ndbj.i	2008-05-20 16:41:08 +0000
@@ -34,6 +34,9 @@
 %rename NdbScanOperation NdbScanOperationImpl;
 %rename NdbTransaction NdbTransactionImpl;
 
+
+
+
 %include "arrays_java.i"
 %include "decimal.i"
 
@@ -82,6 +85,14 @@
         }
 %}
 
+%typemap(in) SWIGTYPE * %{
+  /* Prevent SEGV on null pointers */
+  if ($input == 0) {
+    NDB_exception(NdbApiException,"Object is NULL. This state is usually encountered when using an object after it has been closed");
+    return $null;
+  }
+  $1=*($1_ltype*)&$input;
+%}
 
 %include "NdbClusterConnection.i"
 %include "Ndb.i"

=== modified file 'java/swig/NdbOperation.i'
--- a/java/swig/NdbOperation.i	2008-05-19 19:08:14 +0000
+++ b/java/swig/NdbOperation.i	2008-05-20 16:39:21 +0000
@@ -41,11 +41,5 @@
 
 %typemap(javainterfaces) NdbOperation "NdbOperation";
 %typemap(javabase) NdbOperation "NdbBaseOperationEqualsImpl";
-%typemap(javaout) NdbOperation {
-  NdbOperationImpl theOperation = (NdbOperationImpl)$jnicall; 
-  createdOperations.put(new Long(NdbOperationImpl.getCPtr(theOperation)),
-                        theOperation);
-  return theOperation;
-}
 
 %include "ndbapi/NdbOperation.i"

=== modified file 'java/swig/NdbTransaction.i'
--- a/java/swig/NdbTransaction.i	2008-05-19 19:08:14 +0000
+++ b/java/swig/NdbTransaction.i	2008-05-20 16:39:21 +0000
@@ -51,5 +51,25 @@
 %javamethodmodifiers NdbTransaction::execute "@Override
   public";
 
+%typemap(javaout) NdbOperation * {
+  long cPtr = $jnicall; 
+  if (cPtr == 0) { 
+    return null; 
+  }
+  
+  NdbOperationImpl theOperation = new $javaclassname(cPtr, $owner);
+  createdOperations.put(new Long(cPtr),
+                        theOperation);
+  return theOperation;
+}
+
 %include "ndbapi/NdbTransaction.i"
 
+/* NdbTransaction methods are the only place where we need to do
+   save the Operatoins. Reset typemap. */
+
+%typemap(javaout) NdbOperation * { 
+ long cPtr = $jnicall;
+ return (cPtr == 0) ? null : new $javaclassname(cPtr, $owner);
+}
+  



