List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:November 26 2007 8:55am
Subject:Rev 300: Fixed exception segfault fix. 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: 300
revision-id: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: devel
timestamp: Mon 2007-11-26 00:55:30 -0800
message:
  Fixed exception segfault fix. 
  Cleaned up test program output a little bit.
modified:
  java/ndbj.i                    ndbj.i-20070913223244-5938mztpztyn9sry-1
  java/testsuite/BaseNdbjTestCase.java basejdbc.java-20070517181935-98huwjarzuh25b30-45
  java/testsuite/BaseTestCase.java basetestcase.java-20070523000102-ggam3j202kmrm4es-5
  java/testsuite/ndbj/SelectCountTest.java
selectcounttest.java-20070517181935-98huwjarzuh25b30-61
=== modified file 'java/ndbj.i'
--- a/java/ndbj.i	2007-11-26 08:34:56 +0000
+++ b/java/ndbj.i	2007-11-26 08:55:30 +0000
@@ -88,10 +88,11 @@
   const char * prefix = "com/mysql/cluster/ndbj/";
   if (strncmp(excp,"com.",4)==0) {
     clazz = jenv->FindClass(excp);
-    if (clazz==NULL) 
+    if (clazz==NULL) {
       clazz = jenv->FindClass("java/lang/RuntimeException");
       jenv->ThrowNew(clazz,"Invalid exception class specified");
       return; 
+    }
   } else { 
     char * exception = (char *)malloc(strlen(excp)+strlen(prefix)+1);
     strcpy(exception,prefix);
@@ -99,10 +100,11 @@
 
     clazz = jenv->FindClass(exception);
     free(exception);
-    if (clazz==NULL) 
+    if (clazz==NULL) {
       clazz = jenv->FindClass("java/lang/RuntimeException");
       jenv->ThrowNew(clazz,"Invalid exception class specified");
       return; 
+    }
   }
 
   jenv->ThrowNew(clazz,msg);
@@ -114,10 +116,11 @@
   const char * prefix = "com/mysql/cluster/ndbj/";
   if (strncmp(excp,"com.",4)==0) { 
     clazz = jenv->FindClass(excp);
-    if (clazz==NULL) 
+    if (clazz==NULL) {
       clazz = jenv->FindClass("java/lang/RuntimeException");
       jenv->ThrowNew(clazz,"No callback method!");
       return; 
+    }
   } else { 
     char * exception = (char *)malloc(strlen(excp)+strlen(prefix)+1);
     strcpy(exception,prefix);
@@ -125,10 +128,11 @@
     
     clazz = jenv->FindClass(exception);
     free(exception);
-    if (clazz==NULL) 
+    if (clazz==NULL) {
       clazz = jenv->FindClass("java/lang/RuntimeException");
       jenv->ThrowNew(clazz,"Invalid exception class specified");
       return; 
+    }
   }
 
   jlong errPtr = 0; 

=== modified file 'java/testsuite/BaseNdbjTestCase.java'
--- a/java/testsuite/BaseNdbjTestCase.java	2007-10-23 23:47:41 +0000
+++ b/java/testsuite/BaseNdbjTestCase.java	2007-11-26 08:55:30 +0000
@@ -156,8 +156,9 @@
 	       *  Connect to cluster, done once for each Application
 	       */
 		super.setUp();
+		System.out.println("Running test: "+this.getClass().getName());
     	try { 
-    		System.out.print("Connecting to cluster...");
+    		//System.out.print("Connecting to cluster...");
       	  	conn = NdbFactory.createNdbClusterConnection(NDB_MGMD_CONNECTSTRING);
 
   		    conn.connect(5,3,true);
@@ -167,7 +168,7 @@
 		       */
 		    ndb = conn.createNdb("test",1024);
 
-  		    System.out.println("connected");
+  		    //System.out.println("connected");
     	} catch (NdbApiException e) { 
       		throw new Exception("Failed initialization");
       	}
@@ -176,12 +177,10 @@
 	public void tearDown() throws Exception {
 
 
-		System.out.println("Closing transaction");
 		if (trans != null)
 			trans.close();
 
 		ndb.close();
-		System.out.println("Closing connection");
 		if (conn != null)
 			conn.close();
 		super.tearDown();

=== modified file 'java/testsuite/BaseTestCase.java'
--- a/java/testsuite/BaseTestCase.java	2007-10-29 16:39:46 +0000
+++ b/java/testsuite/BaseTestCase.java	2007-11-26 08:55:30 +0000
@@ -418,9 +418,9 @@
 	 *             if an error occurs.
 	 */
 	public void setUp() throws Exception {
-		System.out.println("Loading JDBC driver '" + this.dbClass + "'");
+		//System.out.println("Loading JDBC driver '" + this.dbClass + "'");
 		Class.forName(this.dbClass).newInstance();
-		System.out.println("Done.\n");
+		//System.out.println("Done.\n");
 		this.createdObjects = new ArrayList<String[]>();
 
 		try {
@@ -430,21 +430,21 @@
 			fail();
 		}
 		
-		System.out.println("Done.\n");
+		//System.out.println("Done.\n");
 		this.stmt = this.conn.createStatement();
 
 		try {
 			if (dbUrl.indexOf("mysql") != -1) {
 				this.rs = this.stmt.executeQuery("SELECT VERSION()");
 				this.rs.next();
-				logDebug("Connected to " + this.rs.getString(1));
+				//logDebug("Connected to " + this.rs.getString(1));
 				this.rs.close();
 				this.rs = null;
 			} else {
-				logDebug("Connected to "
+				/*logDebug("Connected to "
 						+ this.conn.getMetaData().getDatabaseProductName()
 						+ " / "
-						+ this.conn.getMetaData().getDatabaseProductVersion());
+						+ this.conn.getMetaData().getDatabaseProductVersion());*/
 			}
 		} finally {
 			if (this.rs != null) {

=== modified file 'java/testsuite/ndbj/SelectCountTest.java'
--- a/java/testsuite/ndbj/SelectCountTest.java	2007-10-23 05:17:02 +0000
+++ b/java/testsuite/ndbj/SelectCountTest.java	2007-11-26 08:55:30 +0000
@@ -102,8 +102,8 @@
 			assertTrue(false);
 		}
 		finally {
-			if (trans!=null)
-				trans.close();
+			/*if (trans!=null)
+				trans.close();*/
 		}
 
 	}

Thread
Rev 300: Fixed exception segfault fix. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/develMonty Taylor26 Nov