=== modified file 'interface/ndbapi/NdbBlob.i'
--- a/interface/ndbapi/NdbBlob.i	2008-04-19 18:53:30 +0000
+++ b/interface/ndbapi/NdbBlob.i	2008-05-12 07:53:51 +0000
@@ -118,7 +118,7 @@
     static int ret;
     self->getNull(ret);
 
-    return (ret==0);
+    return (ret!=0);
 
   }
 

=== modified file 'java/testsuite/ndbj/NdbBlobTest.java'
--- a/java/testsuite/ndbj/NdbBlobTest.java	2008-04-29 03:40:11 +0000
+++ b/java/testsuite/ndbj/NdbBlobTest.java	2008-05-12 07:53:51 +0000
@@ -12,20 +12,6 @@
 
 import java.sql.SQLException;
 
-/**
- * With the mysql client, do the following:
- * 1. create a table 't1' in the database 'test'.
- * 2. insert some values into the table
- *
- CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` blob,
- PRIMARY KEY (`a`)
- ) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY ();
- INSERT INTO t1 VALUES (1,'jim.......'), (2, 'rob...'), (3, NULL), (4, 'frazer...xxx.....');
- *
- */
-
 public class NdbBlobTest extends BaseNdbjTestCase {
 
 	private static final String tablename = "t_blob";
@@ -36,17 +22,12 @@
 
 	private static String bData = "";
 
-
 	private static final int NUM_ROWS=3;
 
 	public NdbBlobTest(String arg0) {
 		super(arg0);
 	}
 
-	public static void main(String[] args) {
-		junit.textui.TestRunner.run(NdbBlobTest.class);
-	}
-
 	@Override
 	public void setUp() throws Exception {
 		super.setUp();
@@ -58,9 +39,7 @@
 	/*
 	 * Test method for 'com.mysql.cluster.ndbj.NdbOperation.getNdbBlobHandle(int)'
 	 */
-	public final void testBlob() {
-	
-
+	public final void testBlob() throws NdbApiException, SQLException {
 		try {
 
 			bData="ROB...";
@@ -77,17 +56,11 @@
 					bh.setValue(bData.getBytes());
 				}
 
-
 				trans.execute(ExecType.Commit,
 					AbortOption.AbortOnError, true);
 
 				trans.close();
 			}
-
-			assertTrue(true);
-		} catch (NdbApiException e) {
-			System.out.println("Exception " + e.toString());
-			assertTrue(false);
 		} finally {
 			if (trans != null)
 				trans.close();
@@ -128,15 +101,7 @@
 					}
 					
 				}
-        assertFalse(true);
 			}
-
-
-			assertTrue(true);
-		} 
-		catch (SQLException e) {
-			System.out.println("Exception " + e.toString());
-			assertTrue(false);
 		} finally {
 			if (trans != null)
 				trans.close();
@@ -167,13 +132,6 @@
 
 			trans.execute(ExecType.Commit,
 					AbortOption.AbortOnError, true);
-
-
-			assertTrue(true);
-		} 
-		catch (SQLException e) {
-			System.out.println("Exception " + e.toString());
-			assertTrue(false);
 		} finally {
 			if (trans != null)
 				trans.close();
@@ -192,30 +150,26 @@
 			rs = op.resultData();
 			blob = (NdbBlob)rs.getBlob(col2);
 
-			trans.execute(ExecType.Commit,
+			trans.execute(ExecType.NoCommit,
 					AbortOption.AbortOnError, true);
 
 			if (!blob.getNull()) {
+				NdbBlob.State state = blob.getState();
+				System.out.println("Blob state = " + state);
 				byte[] barr = blob.getData();
 
-
 				// TODO: Fix BLOB getLength()
 				/*for (int i = 0; i < blob.getLength().intValue(); i++)
 					System.out.print((char) barr[i]); */
 			} else {
-				assertTrue(false);
+				fail("Blob should not be null");
 			}
-
-
-			assertTrue(true);
-		} 
-		catch (SQLException e) {
-			System.out.println("Exception " + e.toString());
-			assertTrue(false);
+			trans.execute(ExecType.Commit, AbortOption.AbortOnError, true);
 		} finally {
 			if (trans != null)
 				trans.close();
 		}
+
 		try {
 			/**
 			 * Possibility one (not knowing the length of the Blob):
@@ -226,7 +180,7 @@
 
 			NdbOperation op = trans.getSelectOperation(tablename);
 			
-			op.equalInt(1, 1);
+			op.equalInt(col1, 1);
 
 			NdbBlob bh = op.getBlobHandle(col2);
 
@@ -240,16 +194,10 @@
 			bh.readData(buff, len);
 			for (int i = 0; i < len; i++)
 				System.out.print((char) buff[i]);
-			trans.execute(ExecType.Commit,
-					AbortOption.AbortOnError, true);
+			trans.execute(ExecType.Commit, AbortOption.AbortOnError, true);
 
 			long t2 = System.currentTimeMillis();
 			long tot = t2 - t1;
-			assertTrue(true);
-		} 
-		catch (NdbApiException e) {
-			System.out.println("Exception " + e.toString());
-			assertTrue(false);
 		} finally {
 			if (trans != null)
 				trans.close();
@@ -263,7 +211,7 @@
 
 			NdbOperation op = trans.getSelectOperation(tablename);
 			
-			op.equalInt(1, 1);
+			op.equalInt(col1, 1);
 			long t1 = System.currentTimeMillis();
 			NdbBlob bh = op.getBlobHandle(col2);
 
@@ -271,8 +219,7 @@
 
 			bh.getValue(len2);
 
-			trans.execute(ExecType.Commit,
-					AbortOption.AbortOnError, true);
+			trans.execute(ExecType.NoCommit, AbortOption.AbortOnError, true);
 
 			if (!bh.getNull()) {
 				byte[] barr = bh.getData();
@@ -281,13 +228,9 @@
 				/*for (int i = 0; i < bh.getLength().intValue(); i++)
 					System.out.print((char) barr[i]);*/
 			} else {
-				
-				assertTrue(false);
+				fail("Blob should not be null");
 			}
-			assertTrue(true);
-		} catch (NdbApiException e) {
-			System.out.println("Exception " + e.toString());
-			assertTrue(false);
+			trans.execute(ExecType.Commit, AbortOption.AbortOnError, true);
 		} finally {
 			if (trans != null)
 				trans.close();
@@ -301,8 +244,6 @@
 
 			NdbOperation op = trans.getUpdateOperation(tablename);
 
-
-
 			op.equalInt(col1, 2);
 
 			NdbBlob bh = op.getBlobHandle(col2);
@@ -310,19 +251,9 @@
 			byte[] bb2 = { 'f', 'r', 'a', 'z', 'e', 'r', ' ', 'c', 'l', 'e',
 					'm', 'e', 'n', 't', '4', '5' };
 
-
-			trans.execute(ExecType.NoCommit,
-					AbortOption.AbortOnError, true);
-
 			bh.setValue(bb2);
 
-			trans.execute(ExecType.Commit,
-					AbortOption.AbortOnError, true);
-
-			assertTrue(true);
-		} catch (NdbApiException e) {
-			System.out.println("Exception " + e.toString());
-			assertTrue(false);
+			trans.execute(ExecType.Commit, AbortOption.AbortOnError, true);
 		} finally {
 			if (trans != null)
 				trans.close();
@@ -335,7 +266,7 @@
 			trans = ndb.startTransaction();
 
 			NdbOperation op = trans.getSelectOperation(tablename);
-			op.equalInt(1, 1);
+			op.equalInt(col1, 1);
 
 			NdbBlob bh = op.getBlobHandle(col2);
 
@@ -363,12 +294,6 @@
 
 			trans.execute(ExecType.Commit,
 					AbortOption.AbortOnError, true);
-
-			assertTrue(true);
-		} 
-		catch (NdbApiException e) {
-			System.out.println("Exception " + e.toString());
-			assertTrue(false);
 		} finally {
 			if (trans != null)
 				trans.close();
@@ -400,12 +325,6 @@
 
 			long t2 = System.currentTimeMillis();
 			long tot = t2 - t1;
-
-			assertTrue(true);
-		} 
-		catch (SQLException e) {
-			System.out.println("Exception " + e.toString());
-			assertTrue(false);
 		} finally {
 			if (trans != null)
 				trans.close();



