From: Date: October 2 2007 9:49pm Subject: Connector/J commit: r6597 - in trunk: . connector-j connector-j/src/com/mysql/jdbc connector-j/src/testsuite/regression List-Archive: http://lists.mysql.com/commits/34784 X-Bug: 27412 Message-Id: <200710021949.l92JnmGP002712@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/PreparedStatement.java trunk/connector-j/src/testsuite/regression/StatementRegressionTest.java Log: Merged revisions 6573-6593,6595-6596 via svnmerge from svn+ssh://mmatthews@stripped/connectors-svnroot/connector-j/branches/branch_5_0 ....... r6579 | mmatthews | 2007-09-07 12:31:06 -0500 (Fri, 07 Sep 2007) | 2 lines Blocked revisions 3986-3990,4009-4020,4024,4046,4050,4053-4058,4067,4095,4097-4098,4122-4130,4135,4159-4160,4162,4164-4165,4178,4209,4243-4245,4256-4258,4265,4287,4291,4296-4297,4307-4308,4336,4354-4358,4374,4378,4388-4389,4420,4471,4500,4503,4505,4523,4533,4553,4558-4559,4564-4565,4567,4580,4586-4587,4590,4592-4593,4595-4596,4601,4618-4619,4621,4623,4626-4627,4637,4662-4663,4680,4705,4707,4709,4715,4717-4718,4720,4722-4723,4773,4815,4819-4822,4873,4887,4906,4945,4971,4983-4984,5024,5034-5037,5040,5044,5052,5120-5125,5127-5129,5184-5185,5187-5188,5207,5247,5312-5323,5327,5332,5335,5389,5391-5393,5400-5401,5403,5446,5511,5524,5526,5530-5531,5554-5555,5639,5682,5833,5850,5852-5853,5866,5888-5892,5898-5900,5907,5917,5935,6035,6083,6095-6096,6132,6307,6348,6371,6427,6436,6444,6493 via svnmerge [removed log messages to not trip up the bugs system] ....... r6595 | mmatthews | 2007-10-02 14:36:55 -0500 (Tue, 02 Oct 2007) | 2 lines Fixed Bug#27412 - cached metadata with PreparedStatement.execute() throws NullPointerException. ....... Property changes on: trunk ___________________________________________________________________ Name: svnmerge-integrated - /branches/branch_5_0:1-6572,6594 /branches/branch_5_1:1-6566,6576-6577,6584 + /branches/branch_5_0:1-6596 /branches/branch_5_1:1-6566,6576-6577,6584 Modified: trunk/connector-j/CHANGES =================================================================== --- trunk/connector-j/CHANGES 2007-10-02 19:46:56 UTC (rev 6596) +++ trunk/connector-j/CHANGES 2007-10-02 19:49:47 UTC (rev 6597) @@ -270,7 +270,10 @@ - XAConnections now start in auto-commit mode (as per JDBC-4.0 specification clarification). - + + - Fixed Bug#27412 - cached metadata with PreparedStatement.execute() + throws NullPointerException. + 07-19-07 - Version 5.0.7 - Setting the configuration parameter "useCursorFetch" to "true" for Modified: trunk/connector-j/src/com/mysql/jdbc/PreparedStatement.java =================================================================== --- trunk/connector-j/src/com/mysql/jdbc/PreparedStatement.java 2007-10-02 19:46:56 UTC (rev 6596) +++ trunk/connector-j/src/com/mysql/jdbc/PreparedStatement.java 2007-10-02 19:49:47 UTC (rev 6597) @@ -1006,7 +1006,7 @@ } else { if (rs.reallyResult() && locallyScopedConn.getCacheResultSetMetadata()) { locallyScopedConn.initializeResultsMetadataFromCache(this.originalSql, - null /* will be created */, this.results); + null /* will be created */, rs); } } Modified: trunk/connector-j/src/testsuite/regression/StatementRegressionTest.java =================================================================== --- trunk/connector-j/src/testsuite/regression/StatementRegressionTest.java 2007-10-02 19:46:56 UTC (rev 6596) +++ trunk/connector-j/src/testsuite/regression/StatementRegressionTest.java 2007-10-02 19:49:47 UTC (rev 6597) @@ -47,10 +47,8 @@ import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.Statement; -import java.sql.Time; import java.sql.Timestamp; import java.sql.Types; -import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; import java.util.Properties; @@ -3176,6 +3174,7 @@ return isJdbc4; } + /** * Tests fix for BUG#19615, PreparedStatement.setObject(int, Object, int) * doesn't respect scale of BigDecimals. @@ -4075,4 +4074,29 @@ } } } + + /** + * Tests fix for Bug#27412 - cached metadata with PreparedStatement.execute() + * throws NullPointerException. + * + * @throws Exception + */ + public void testBug27412() throws Exception { + try { + Properties props = new Properties(); + props.put("useServerPrepStmts", "false"); + props.put("cachePreparedStatements", "true"); + props.put("cacheResultSetMetadata", "true"); + Connection conn2 = getConnectionWithProps(props); + PreparedStatement pstm = conn2.prepareStatement("SELECT 1"); + try { + assertTrue(pstm.execute()); + } finally { + pstm.close(); + conn2.close(); + } + } finally { + closeMemberJDBCResources(); + } + } }