From: Date: August 30 2007 11:39pm Subject: Connector/J commit: r6538 - in trunk: . connector-j connector-j/src/com/mysql/jdbc connector-j/src/testsuite/regression List-Archive: http://lists.mysql.com/commits/33480 X-Bug: 29852 Message-Id: <200708302139.l7ULd4Ns020780@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified: trunk/ trunk/connector-j/CHANGES trunk/connector-j/src/com/mysql/jdbc/LoadBalancingConnectionProxy.java trunk/connector-j/src/com/mysql/jdbc/NonRegisteringDriver.java trunk/connector-j/src/testsuite/regression/ConnectionRegressionTest.java Log: Merged revisions 6535-6537 via svnmerge from svn+ssh://mmatthews@stripped/connectors-svnroot/connector-j/branches/branch_5_0 ....... r6537 | mmatthews | 2007-08-30 16:26:34 -0500 (Thu, 30 Aug 2007) | 3 lines Fixed BUG#29852 - Closing a load-balanced connection would cause a ClassCastException. ....... Property changes on: trunk ___________________________________________________________________ Name: svnmerge-integrated - /branches/branch_5_0:1-6534 /branches/branch_5_1:1-6517 + /branches/branch_5_0:1-6537 /branches/branch_5_1:1-6517 Modified: trunk/connector-j/CHANGES =================================================================== --- trunk/connector-j/CHANGES 2007-08-30 21:26:34 UTC (rev 6537) +++ trunk/connector-j/CHANGES 2007-08-30 21:39:03 UTC (rev 6538) @@ -199,16 +199,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: trunk/connector-j/src/com/mysql/jdbc/LoadBalancingConnectionProxy.java =================================================================== --- trunk/connector-j/src/com/mysql/jdbc/LoadBalancingConnectionProxy.java 2007-08-30 21:26:34 UTC (rev 6537) +++ trunk/connector-j/src/com/mysql/jdbc/LoadBalancingConnectionProxy.java 2007-08-30 21:39:03 UTC (rev 6538) @@ -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: trunk/connector-j/src/com/mysql/jdbc/NonRegisteringDriver.java =================================================================== --- trunk/connector-j/src/com/mysql/jdbc/NonRegisteringDriver.java 2007-08-30 21:26:34 UTC (rev 6537) +++ trunk/connector-j/src/com/mysql/jdbc/NonRegisteringDriver.java 2007-08-30 21:39:03 UTC (rev 6538) @@ -321,7 +321,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: trunk/connector-j/src/testsuite/regression/ConnectionRegressionTest.java =================================================================== --- trunk/connector-j/src/testsuite/regression/ConnectionRegressionTest.java 2007-08-30 21:26:34 UTC (rev 6537) +++ trunk/connector-j/src/testsuite/regression/ConnectionRegressionTest.java 2007-08-30 21:39:03 UTC (rev 6538) @@ -2159,4 +2159,21 @@ } } } -} \ No newline at end of file + + 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(); + } +}