List:Commits« Previous MessageNext Message »
From:mmatthews Date:July 18 2006 4:49pm
Subject:Connector/J commit: r5525 - in branches: branch_5_0/connector-j branch_5_0/connector-j/src/com/mysql/jdbc branch_5_0/connector-j/src/testsuite/regress...
View as plain text  
Modified:
   branches/branch_5_0/connector-j/CHANGES
   branches/branch_5_0/connector-j/src/com/mysql/jdbc/Statement.java
   branches/branch_5_0/connector-j/src/testsuite/regression/StatementRegressionTest.java
   branches/branch_5_1/connector-j/CHANGES
   branches/branch_5_1/connector-j/src/com/mysql/jdbc/Statement.java
   branches/branch_5_1/connector-j/src/testsuite/regression/StatementRegressionTest.java
Log:
Fixed BUG#20650 - Statement.cancel() causes NullPointerException
      if underlying connection has been closed due to server failure.

Modified: branches/branch_5_0/connector-j/CHANGES
===================================================================
--- branches/branch_5_0/connector-j/CHANGES	2006-07-18 16:00:59 UTC (rev 5524)
+++ branches/branch_5_0/connector-j/CHANGES	2006-07-18 16:49:10 UTC (rev 5525)
@@ -1,6 +1,11 @@
 # Changelog
 # $Id$
 
+07-nn-06 - Version 5.0.3
+
+    - Fixed BUG#20650 - Statement.cancel() causes NullPointerException
+      if underlying connection has been closed due to server failure.
+      
 07-11-06 - Version 5.0.2-beta (5.0.1 not released due to packaging error)
 
     - Fixed BUG#17401 - Can't use XAConnection for local transactions when

Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/Statement.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/Statement.java	2006-07-18 16:00:59 UTC (rev 5524)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/Statement.java	2006-07-18 16:49:10 UTC (rev 5525)
@@ -331,12 +331,14 @@
 	 * cancel a statement that is being executed by another thread.
 	 */
 	public void cancel() throws SQLException {
-		if (this.connection.versionMeetsMinimum(5, 0, 0)) {
+		if (!this.isClosed &&
+				this.connection != null && 
+				this.connection.versionMeetsMinimum(5, 0, 0)) {
 			Connection cancelConn = null;
 			java.sql.Statement cancelStmt = null;
 
 			try {
-				cancelConn = connection.duplicate();
+				cancelConn = this.connection.duplicate();
 				cancelStmt = cancelConn.createStatement();
 				cancelStmt.execute("KILL QUERY "
 						+ this.connection.getIO().getThreadId());

Modified: branches/branch_5_0/connector-j/src/testsuite/regression/StatementRegressionTest.java
===================================================================
--- branches/branch_5_0/connector-j/src/testsuite/regression/StatementRegressionTest.java	2006-07-18 16:00:59 UTC (rev 5524)
+++ branches/branch_5_0/connector-j/src/testsuite/regression/StatementRegressionTest.java	2006-07-18 16:49:10 UTC (rev 5525)
@@ -3333,4 +3333,32 @@
 			}
 		}
 	}
+
+	/**
+	 * Tests fix for BUG#20650 - Statement.cancel() causes NullPointerException
+     * if underlying connection has been closed due to server failure.
+     * 
+	 * @throws Exception if the test fails.
+	 */
+	public void testBug20650() throws Exception {
+		Connection closedConn = null;
+		Statement cancelStmt = null;
+		
+		try {
+			closedConn = getConnectionWithProps(null);
+			cancelStmt = closedConn.createStatement();
+		
+			closedConn.close();
+
+			cancelStmt.cancel();
+		} finally {
+			if (cancelStmt != null) {
+				cancelStmt.close();
+			}
+			
+			if (closedConn != null && !closedConn.isClosed()) {
+				closedConn.close();
+			}
+		}
+	}
 }

Modified: branches/branch_5_1/connector-j/CHANGES
===================================================================
--- branches/branch_5_1/connector-j/CHANGES	2006-07-18 16:00:59 UTC (rev 5524)
+++ branches/branch_5_1/connector-j/CHANGES	2006-07-18 16:49:10 UTC (rev 5525)
@@ -3,8 +3,13 @@
 
 xx-xx-06 - Version 5.1.0-alpha
 
-xx-xx-06 - Version 5.0.1-beta
+07-nn-06 - Version 5.0.3
 
+    - Fixed BUG#20650 - Statement.cancel() causes NullPointerException
+      if underlying connection has been closed due to server failure.
+      
+07-11-06 - Version 5.0.2-beta (5.0.1 not released due to packaging error)
+
     - Fixed BUG#17401 - Can't use XAConnection for local transactions when
       no global transaction is in progress.
       
@@ -22,6 +27,25 @@
 	  
 	- Fixed BUG#20242 - MysqlValidConnectionChecker for JBoss doesn't
 	  work with MySQLXADataSources.
+	  
+	- Better caching of character set converters (per-connection)
+	  to remove a bottleneck for multibyte character sets.
+	  
+	- Added connection/datasource property  "pinGlobalTxToPhysicalConnection" 
+	  (defaults to "false"). When set to "true", when using XAConnections, the 
+	  driver ensures that operations on a given XID are always routed to the 
+	  same physical connection. This allows the XAConnection to support 
+	  "XA START ... JOIN" after "XA END" has been called, and is also a 
+	  workaround for transaction managers that don't maintain thread affinity
+	  for a global transaction (most either always maintain thread affinity, 
+	  or have it as a configuration option).
+	  
+	- MysqlXaConnection.recover(int flags) now allows combinations of 
+	  XAResource.TMSTARTRSCAN and TMENDRSCAN. To simulate the "scanning"
+	  nature of the interface, we return all prepared XIDs for TMSTARTRSCAN,
+	  and no new XIDs for calls with TMNOFLAGS, or TMENDRSCAN when not in
+	  combination with TMSTARTRSCAN. This change was made for API compliance,
+	  as well as integration with IBM WebSphere's transaction manager.
       
 12-23-05 - Version 5.0.0-beta
 

Modified: branches/branch_5_1/connector-j/src/com/mysql/jdbc/Statement.java
===================================================================
--- branches/branch_5_1/connector-j/src/com/mysql/jdbc/Statement.java	2006-07-18 16:00:59 UTC (rev 5524)
+++ branches/branch_5_1/connector-j/src/com/mysql/jdbc/Statement.java	2006-07-18 16:49:10 UTC (rev 5525)
@@ -339,12 +339,14 @@
 	 * cancel a statement that is being executed by another thread.
 	 */
 	public void cancel() throws SQLException {
-		if (this.connection.versionMeetsMinimum(5, 0, 0)) {
+		if (!this.isClosed &&
+				this.connection != null && 
+				this.connection.versionMeetsMinimum(5, 0, 0)) {
 			Connection cancelConn = null;
 			java.sql.Statement cancelStmt = null;
 
 			try {
-				cancelConn = connection.duplicate();
+				cancelConn = this.connection.duplicate();
 				cancelStmt = cancelConn.createStatement();
 				cancelStmt.execute("KILL QUERY "
 						+ this.connection.getIO().getThreadId());

Modified: branches/branch_5_1/connector-j/src/testsuite/regression/StatementRegressionTest.java
===================================================================
--- branches/branch_5_1/connector-j/src/testsuite/regression/StatementRegressionTest.java	2006-07-18 16:00:59 UTC (rev 5524)
+++ branches/branch_5_1/connector-j/src/testsuite/regression/StatementRegressionTest.java	2006-07-18 16:49:10 UTC (rev 5525)
@@ -3209,4 +3209,32 @@
 		}
 	}
 
+	/**
+	 * Tests fix for BUG#20650 - Statement.cancel() causes NullPointerException
+	 * if underlying connection has been closed due to server failure.
+	 * 
+	 * @throws Exception if the test fails.
+	 */
+	public void testBug20650() throws Exception {
+		Connection closedConn = null;
+		Statement cancelStmt = null;
+		
+		try {
+			closedConn = getConnectionWithProps(null);
+			cancelStmt = closedConn.createStatement();
+		
+			closedConn.close();
+	
+			cancelStmt.cancel();
+		} finally {
+			if (cancelStmt != null) {
+				cancelStmt.close();
+			}
+			
+			if (closedConn != null && !closedConn.isClosed()) {
+				closedConn.close();
+			}
+		}
+	}
+
 }

Thread
Connector/J commit: r5525 - in branches: branch_5_0/connector-j branch_5_0/connector-j/src/com/mysql/jdbc branch_5_0/connector-j/src/testsuite/regress...mmatthews18 Jul