List:Commits« Previous MessageNext Message »
From:mmatthews Date:August 30 2007 9:26pm
Subject:Connector/J commit: r6537 - in branches/branch_5_0/connector-j: . src/com/mysql/jdbc src/testsuite/regression
View as plain text  
Modified:
   branches/branch_5_0/connector-j/CHANGES
   branches/branch_5_0/connector-j/src/com/mysql/jdbc/LoadBalancingConnectionProxy.java
   branches/branch_5_0/connector-j/src/com/mysql/jdbc/NonRegisteringDriver.java
   branches/branch_5_0/connector-j/src/testsuite/regression/ConnectionRegressionTest.java
Log:
Fixed BUG#29852 - Closing a load-balanced connection would cause a
      ClassCastException.
        

Modified: branches/branch_5_0/connector-j/CHANGES
===================================================================
--- branches/branch_5_0/connector-j/CHANGES	2007-08-30 20:56:36 UTC (rev 6536)
+++ branches/branch_5_0/connector-j/CHANGES	2007-08-30 21:26:34 UTC (rev 6537)
@@ -21,16 +21,19 @@
     - Fixed BUG#29106 - Connection checker for JBoss didn't use same method parameters
       via reflection, causing connections to always seem "bad".
       
-    - Fixed BUG#30664. Note that this fix only works for MySQL server 
+    - Fixed BUG#30664 - Note that this fix only works for MySQL server 
       versions 5.0.25 and newer, since earlier versions didn't consistently 
       return correct metadata for functions, and thus results from 
       subqueries and functions were indistinguishable from each other, 
       leading to type-related bugs.
 
-    - Fixed BUG#28972, DatabaseMetaData.getTypeInfo() for the types DECIMAL
+    - Fixed BUG#28972 - DatabaseMetaData.getTypeInfo() for the types DECIMAL
       and NUMERIC will return a precision of 254 for server versions older than
       5.0.3, 64 for versions 5.0.3-5.0.5 and 65 for versions newer than 5.0.5.
-       
+    
+    - Fixed BUG#29852 - Closing a load-balanced connection would cause a
+      ClassCastException.
+        
 07-19-07 - Version 5.0.7
 
     - Setting the configuration parameter "useCursorFetch" to "true" for 

Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/LoadBalancingConnectionProxy.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/LoadBalancingConnectionProxy.java	2007-08-30 20:56:36 UTC (rev 6536)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/LoadBalancingConnectionProxy.java	2007-08-30 21:26:34 UTC (rev 6537)
@@ -318,7 +318,7 @@
 		if ("close".equals(methodName)) {
 			synchronized (this.liveConnections) {
 				// close all underlying connections
-				Iterator allConnections = this.liveConnections.entrySet()
+				Iterator allConnections = this.liveConnections.values()
 						.iterator();
 
 				while (allConnections.hasNext()) {

Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/NonRegisteringDriver.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/NonRegisteringDriver.java	2007-08-30 20:56:36 UTC (rev 6536)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/NonRegisteringDriver.java	2007-08-30 21:26:34 UTC (rev 6537)
@@ -323,7 +323,7 @@
 		LoadBalancingConnectionProxy proxyBal = new LoadBalancingConnectionProxy(
 				hostList, parsedProps);
 
-		return (Connection) java.lang.reflect.Proxy.newProxyInstance(this
+		return (java.sql.Connection) java.lang.reflect.Proxy.newProxyInstance(this
 				.getClass().getClassLoader(),
 				new Class[] { java.sql.Connection.class }, proxyBal);
 	}

Modified: branches/branch_5_0/connector-j/src/testsuite/regression/ConnectionRegressionTest.java
===================================================================
--- branches/branch_5_0/connector-j/src/testsuite/regression/ConnectionRegressionTest.java	2007-08-30 20:56:36 UTC (rev 6536)
+++ branches/branch_5_0/connector-j/src/testsuite/regression/ConnectionRegressionTest.java	2007-08-30 21:26:34 UTC (rev 6537)
@@ -2140,4 +2140,21 @@
 			}
 		}
 	}
+	
+	public void testBug29852() throws Exception {
+    	int indexOfHostStart = dbUrl.indexOf("://") + 3;
+    	int indexOfHostEnd = dbUrl.indexOf("/", indexOfHostStart);
+    	
+    	String backHalf = dbUrl.substring(indexOfHostStart, indexOfHostEnd);
+    	
+    	if (backHalf.length() == 0) {
+    		backHalf = "localhost:3306";
+    	}
+    	
+    	String dbAndConfigs = dbUrl.substring(indexOfHostEnd);
+    	
+    	Connection lbConn = DriverManager.getConnection("jdbc:mysql:loadbalance://" + backHalf + "," + backHalf + dbAndConfigs);
+    	assertTrue(!lbConn.getClass().getName().startsWith("com.mysql.jdbc"));
+    	lbConn.close();
+    }
 }
\ No newline at end of file

Thread
Connector/J commit: r6537 - in branches/branch_5_0/connector-j: . src/com/mysql/jdbc src/testsuite/regressionmmatthews30 Aug