From: Date: June 16 2006 8:35pm Subject: Connector/J commit: r5400 - in branches: branch_3_1/connector-j branch_3_1/connector-j/src/com/mysql/jdbc branch_5_0/connector-j branch_5_0/connector-j/src/com/mysql/jdbc branch_5_1/connector-j branch_5_1/connector-j/src/com/mysql/jdbc List-Archive: http://lists.mysql.com/commits/7780 X-Bug: 19726 Message-Id: <200606161835.k5GIZdVp013078@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified: branches/branch_3_1/connector-j/CHANGES branches/branch_3_1/connector-j/src/com/mysql/jdbc/StandardSocketFactory.java branches/branch_5_0/connector-j/CHANGES branches/branch_5_0/connector-j/src/com/mysql/jdbc/StandardSocketFactory.java branches/branch_5_1/connector-j/CHANGES branches/branch_5_1/connector-j/src/com/mysql/jdbc/StandardSocketFactory.java Log: Fixed BUG#19726 - Connection fails to localhost when using timeout and IPv6 is configured. Modified: branches/branch_3_1/connector-j/CHANGES =================================================================== --- branches/branch_3_1/connector-j/CHANGES 2006-06-16 17:55:13 UTC (rev 5399) +++ branches/branch_3_1/connector-j/CHANGES 2006-06-16 18:35:35 UTC (rev 5400) @@ -10,6 +10,9 @@ a BIT column fails when server-side prepared statements are used. - Fixed BUG#16987 - Memory leak with profileSQL=true. + + - Fixed BUG#19726 - Connection fails to localhost when using + timeout and IPv6 is configured. 05-26-06 - Version 3.1.13 Modified: branches/branch_3_1/connector-j/src/com/mysql/jdbc/StandardSocketFactory.java =================================================================== --- branches/branch_3_1/connector-j/src/com/mysql/jdbc/StandardSocketFactory.java 2006-06-16 17:55:13 UTC (rev 5399) +++ branches/branch_3_1/connector-j/src/com/mysql/jdbc/StandardSocketFactory.java 2006-06-16 18:35:35 UTC (rev 5400) @@ -163,24 +163,24 @@ Class inetSocketAddressClass = Class .forName("java.net.InetSocketAddress"); Constructor addrConstructor = inetSocketAddressClass - .getConstructor(new Class[] { String.class, - Integer.TYPE }); + .getConstructor(new Class[] { InetAddress.class, + Integer.TYPE }); - InetAddress[] possibleAddresses = InetAddress - .getAllByName(this.host); + InetAddress[] possibleAddresses = InetAddress + .getAllByName(this.host); - Exception caughtWhileConnecting = null; + Exception caughtWhileConnecting = null; - // Need to loop through all possible addresses, in case - // someone has IPV6 configured (SuSE, for example...) + // Need to loop through all possible addresses, in case + // someone has IPV6 configured (SuSE, for example...) - for (int i = 0; i < possibleAddresses.length; i++) { - - try { - Object sockAddr = addrConstructor - .newInstance(new Object[] { this.host, - new Integer(port) }); - + for (int i = 0; i < possibleAddresses.length; i++) { + + try { + Object sockAddr = addrConstructor + .newInstance(new Object[] { possibleAddresses[i], + new Integer(port) }); + rawSocket = new Socket(); connectWithTimeoutMethod.invoke(rawSocket, new Object[] { sockAddr, Modified: branches/branch_5_0/connector-j/CHANGES =================================================================== --- branches/branch_5_0/connector-j/CHANGES 2006-06-16 17:55:13 UTC (rev 5399) +++ branches/branch_5_0/connector-j/CHANGES 2006-06-16 18:35:35 UTC (rev 5400) @@ -150,6 +150,9 @@ a BIT column fails when server-side prepared statements are used. - Fixed BUG#16987 - Memory leak with profileSQL=true. + + - Fixed BUG#19726 - Connection fails to localhost when using + timeout and IPv6 is configured. 05-26-06 - Version 3.1.13 Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/StandardSocketFactory.java =================================================================== --- branches/branch_5_0/connector-j/src/com/mysql/jdbc/StandardSocketFactory.java 2006-06-16 17:55:13 UTC (rev 5399) +++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/StandardSocketFactory.java 2006-06-16 18:35:35 UTC (rev 5400) @@ -163,24 +163,24 @@ Class inetSocketAddressClass = Class .forName("java.net.InetSocketAddress"); Constructor addrConstructor = inetSocketAddressClass - .getConstructor(new Class[] { String.class, - Integer.TYPE }); + .getConstructor(new Class[] { InetAddress.class, + Integer.TYPE }); - InetAddress[] possibleAddresses = InetAddress - .getAllByName(this.host); + InetAddress[] possibleAddresses = InetAddress + .getAllByName(this.host); - Exception caughtWhileConnecting = null; + Exception caughtWhileConnecting = null; - // Need to loop through all possible addresses, in case - // someone has IPV6 configured (SuSE, for example...) + // Need to loop through all possible addresses, in case + // someone has IPV6 configured (SuSE, for example...) - for (int i = 0; i < possibleAddresses.length; i++) { - - try { - Object sockAddr = addrConstructor - .newInstance(new Object[] { this.host, - new Integer(port) }); - + for (int i = 0; i < possibleAddresses.length; i++) { + + try { + Object sockAddr = addrConstructor + .newInstance(new Object[] { possibleAddresses[i], + new Integer(port) }); + rawSocket = new Socket(); connectWithTimeoutMethod.invoke(rawSocket, new Object[] { sockAddr, Modified: branches/branch_5_1/connector-j/CHANGES =================================================================== --- branches/branch_5_1/connector-j/CHANGES 2006-06-16 17:55:13 UTC (rev 5399) +++ branches/branch_5_1/connector-j/CHANGES 2006-06-16 18:35:35 UTC (rev 5400) @@ -124,6 +124,9 @@ a BIT column fails when server-side prepared statements are used. - Fixed BUG#16987 - Memory leak with profileSQL=true. + + - Fixed BUG#19726 - Connection fails to localhost when using + timeout and IPv6 is configured. 05-26-06 - Version 3.1.13 Modified: branches/branch_5_1/connector-j/src/com/mysql/jdbc/StandardSocketFactory.java =================================================================== --- branches/branch_5_1/connector-j/src/com/mysql/jdbc/StandardSocketFactory.java 2006-06-16 17:55:13 UTC (rev 5399) +++ branches/branch_5_1/connector-j/src/com/mysql/jdbc/StandardSocketFactory.java 2006-06-16 18:35:35 UTC (rev 5400) @@ -163,24 +163,24 @@ Class inetSocketAddressClass = Class .forName("java.net.InetSocketAddress"); Constructor addrConstructor = inetSocketAddressClass - .getConstructor(new Class[] { String.class, - Integer.TYPE }); + .getConstructor(new Class[] { InetAddress.class, + Integer.TYPE }); - InetAddress[] possibleAddresses = InetAddress - .getAllByName(this.host); + InetAddress[] possibleAddresses = InetAddress + .getAllByName(this.host); - Exception caughtWhileConnecting = null; + Exception caughtWhileConnecting = null; - // Need to loop through all possible addresses, in case - // someone has IPV6 configured (SuSE, for example...) + // Need to loop through all possible addresses, in case + // someone has IPV6 configured (SuSE, for example...) - for (int i = 0; i < possibleAddresses.length; i++) { - - try { - Object sockAddr = addrConstructor - .newInstance(new Object[] { this.host, - new Integer(port) }); - + for (int i = 0; i < possibleAddresses.length; i++) { + + try { + Object sockAddr = addrConstructor + .newInstance(new Object[] { possibleAddresses[i], + new Integer(port) }); + rawSocket = new Socket(); connectWithTimeoutMethod.invoke(rawSocket, new Object[] { sockAddr, @@ -207,7 +207,7 @@ throw (SocketException) t; } } - + try { this.rawSocket.setTcpNoDelay(true); } catch (Exception ex) {