From: Date: March 1 2007 11:24pm Subject: Connector/J commit: r6337 - branches/branch_5_0/connector-j branches/branch_5_0/connector-j/src/com/mysql/jdbc branches/branch_5_0/connector-j/src/testsuite/regression trunk/connector-j trunk/connector-j/src/com/mysql/jdbc trunk/connector-j/src/testsuite/regression List-Archive: http://lists.mysql.com/commits/20953 X-Bug: 25624 Message-Id: <200703012224.l21MO5mO023584@bk-internal.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modified: branches/branch_5_0/connector-j/CHANGES branches/branch_5_0/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java branches/branch_5_0/connector-j/src/testsuite/regression/MetaDataRegressionTest.java trunk/connector-j/CHANGES trunk/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java trunk/connector-j/src/testsuite/regression/MetaDataRegressionTest.java Log: Fixed BUG#25624 - Whitespace surrounding storage/size specifiers in stored procedure parameters declaration causes NumberFormatException to be thrown when calling stored procedure on JDK-1.5 or newer, as the Number classes in JDK-1.5+ are whitespace intolerant. Modified: branches/branch_5_0/connector-j/CHANGES =================================================================== --- branches/branch_5_0/connector-j/CHANGES 2007-03-01 22:00:26 UTC (rev 6336) +++ branches/branch_5_0/connector-j/CHANGES 2007-03-01 22:24:01 UTC (rev 6337) @@ -9,7 +9,12 @@ - Fixed BUG#26592 - PreparedStatement is not closed in BlobFromLocator.getBytes(). - + + - Fixed BUG#25624 - Whitespace surrounding storage/size specifiers in + stored procedure parameters declaration causes NumberFormatException to + be thrown when calling stored procedure on JDK-1.5 or newer, as the Number + classes in JDK-1.5+ are whitespace intolerant. + 03-01-07 - Version 5.0.5 - Fixed BUG#23645 - Some collations/character sets reported as "unknown" Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java =================================================================== --- branches/branch_5_0/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java 2007-03-01 22:00:26 UTC (rev 6336) +++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java 2007-03-01 22:24:01 UTC (rev 6337) @@ -257,10 +257,10 @@ } else if (typeInfo.indexOf(",") != -1) { // Numeric with decimals this.columnSize = new Integer(typeInfo.substring((typeInfo - .indexOf("(") + 1), (typeInfo.indexOf(",")))); + .indexOf("(") + 1), (typeInfo.indexOf(","))).trim()); this.decimalDigits = new Integer(typeInfo.substring( (typeInfo.indexOf(",") + 1), - (typeInfo.indexOf(")")))); + (typeInfo.indexOf(")"))).trim()); } else { this.columnSize = null; this.decimalDigits = null; @@ -280,7 +280,7 @@ } this.columnSize = new Integer(typeInfo.substring( - (typeInfo.indexOf("(") + 1), endParenIndex)); + (typeInfo.indexOf("(") + 1), endParenIndex).trim()); // Adjust for pseudo-boolean if (conn.getTinyInt1isBit() Modified: branches/branch_5_0/connector-j/src/testsuite/regression/MetaDataRegressionTest.java =================================================================== --- branches/branch_5_0/connector-j/src/testsuite/regression/MetaDataRegressionTest.java 2007-03-01 22:00:26 UTC (rev 6336) +++ branches/branch_5_0/connector-j/src/testsuite/regression/MetaDataRegressionTest.java 2007-03-01 22:24:01 UTC (rev 6337) @@ -1928,4 +1928,27 @@ fail(messageBuf.toString()); } } + + /** + * Tests fix for BUG#25624 - Whitespace surrounding storage/size specifiers in stored procedure + * declaration causes NumberFormatException to be thrown when calling stored procedure. + * + * @throws Exception + */ + public void testBug25624() throws Exception { + if (!versionMeetsMinimum(5, 0)) { + return; + } + + // + // we changed up the parameters to get coverage of the fixes, + // also note that whitespace _is_ significant in the DDL... + // + + createProcedure( + "testBug25624", + "(in _par1 decimal( 10 , 2 ) , in _par2 varchar( 4 )) BEGIN select 1; END"); + + this.conn.prepareCall("{call testBug25624(?,?)}").close(); + } } Modified: trunk/connector-j/CHANGES =================================================================== --- trunk/connector-j/CHANGES 2007-03-01 22:00:26 UTC (rev 6336) +++ trunk/connector-j/CHANGES 2007-03-01 22:24:01 UTC (rev 6337) @@ -13,7 +13,12 @@ - Fixed BUG#26592 - PreparedStatement is not closed in BlobFromLocator.getBytes(). - + + - Fixed BUG#25624 - Whitespace surrounding storage/size specifiers in + stored procedure parameters declaration causes NumberFormatException to + be thrown when calling stored procedure on JDK-1.5 or newer, as the Number + classes in JDK-1.5+ are whitespace intolerant. + 03-01-07 - Version 5.0.5 - Fixed BUG#23645 - Some collations/character sets reported as "unknown" Modified: trunk/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java =================================================================== --- trunk/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java 2007-03-01 22:00:26 UTC (rev 6336) +++ trunk/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java 2007-03-01 22:24:01 UTC (rev 6337) @@ -258,10 +258,10 @@ } else if (typeInfo.indexOf(",") != -1) { // Numeric with decimals this.columnSize = new Integer(typeInfo.substring((typeInfo - .indexOf("(") + 1), (typeInfo.indexOf(",")))); + .indexOf("(") + 1), (typeInfo.indexOf(","))).trim()); this.decimalDigits = new Integer(typeInfo.substring( (typeInfo.indexOf(",") + 1), - (typeInfo.indexOf(")")))); + (typeInfo.indexOf(")"))).trim()); } else { this.columnSize = null; this.decimalDigits = null; @@ -281,7 +281,7 @@ } this.columnSize = new Integer(typeInfo.substring( - (typeInfo.indexOf("(") + 1), endParenIndex)); + (typeInfo.indexOf("(") + 1), endParenIndex).trim()); // Adjust for pseudo-boolean if (conn.getTinyInt1isBit() Modified: trunk/connector-j/src/testsuite/regression/MetaDataRegressionTest.java =================================================================== --- trunk/connector-j/src/testsuite/regression/MetaDataRegressionTest.java 2007-03-01 22:00:26 UTC (rev 6336) +++ trunk/connector-j/src/testsuite/regression/MetaDataRegressionTest.java 2007-03-01 22:24:01 UTC (rev 6337) @@ -1929,4 +1929,26 @@ } } + /** + * Tests fix for BUG#25624 - Whitespace surrounding storage/size specifiers in stored procedure + * declaration causes NumberFormatException to be thrown when calling stored procedure. + * + * @throws Exception + */ + public void testBug25624() throws Exception { + if (!versionMeetsMinimum(5, 0)) { + return; + } + + // + // we changed up the parameters to get coverage of the fixes, + // also note that whitespace _is_ significant in the DDL... + // + + createProcedure( + "testBug25624", + "(in _par1 decimal( 10 , 2 ) , in _par2 varchar( 4 )) BEGIN select 1; END"); + + this.conn.prepareCall("{call testBug25624(?,?)}").close(); + } }