Modified:
branches/branch_3_1/connector-j/CHANGES
branches/branch_3_1/connector-j/src/com/mysql/jdbc/ConnectionProperties.java
branches/branch_3_1/connector-j/src/com/mysql/jdbc/PreparedStatement.java
branches/branch_3_1/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java
branches/branch_3_1/connector-j/src/testsuite/regression/StatementRegressionTest.java
branches/branch_5_0/connector-j/CHANGES
branches/branch_5_0/connector-j/src/com/mysql/jdbc/ConnectionProperties.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/PreparedStatement.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java
branches/branch_5_0/connector-j/src/testsuite/regression/StatementRegressionTest.java
trunk/connector-j/CHANGES
trunk/connector-j/src/com/mysql/jdbc/ConnectionProperties.java
trunk/connector-j/src/com/mysql/jdbc/PreparedStatement.java
trunk/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java
trunk/connector-j/src/testsuite/regression/StatementRegressionTest.java
Log:
- Fixed Bug#21207 - Driver throws NPE when tracing prepared statements
that have been closed (in asSQL()).
- Removed logger autodectection altogether, must now specify logger
explitly if you want to use a logger other than one that logs
to STDERR.
Modified: branches/branch_3_1/connector-j/CHANGES
===================================================================
--- branches/branch_3_1/connector-j/CHANGES 2006-08-30 00:01:01 UTC (rev 5681)
+++ branches/branch_3_1/connector-j/CHANGES 2006-08-30 18:09:53 UTC (rev 5682)
@@ -39,7 +39,14 @@
- Fixed calling toString() on ResultSetMetaData for driver-generated
(i.e. from DatabaseMetaData method calls, or from getGeneratedKeys())
result sets would raise a NullPointerException.
-
+
+ - Fixed Bug#21207 - Driver throws NPE when tracing prepared statements that
+ have been closed (in asSQL()).
+
+ - Removed logger autodectection altogether, must now specify logger
+ explitly if you want to use a logger other than one that logs
+ to STDERR.
+
05-26-06 - Version 3.1.13
- Fixed BUG#15464 - INOUT parameter does not store IN value.
Modified: branches/branch_3_1/connector-j/src/com/mysql/jdbc/ConnectionProperties.java
===================================================================
---
branches/branch_3_1/connector-j/src/com/mysql/jdbc/ConnectionProperties.java 2006-08-30
00:01:01 UTC (rev 5681)
+++
branches/branch_3_1/connector-j/src/com/mysql/jdbc/ConnectionProperties.java 2006-08-30
18:09:53 UTC (rev 5682)
@@ -543,12 +543,8 @@
private static final ArrayList PROPERTY_LIST = new ArrayList();
- //
- // Yes, this looks goofy, but we're trying to avoid intern()ing here
- //
- private static final String STANDARD_LOGGER_NAME = new String(StandardLogger.class
- .getName().getBytes());
-
+ private static final String STANDARD_LOGGER_NAME = StandardLogger.class.getName();
+
protected static final String ZERO_DATETIME_BEHAVIOR_CONVERT_TO_NULL = "convertToNull";
protected static final String ZERO_DATETIME_BEHAVIOR_EXCEPTION = "exception";
@@ -1569,7 +1565,7 @@
/**
* @return Returns the allowNanAndInf.
*/
- protected boolean getAllowNanAndInf() {
+ public boolean getAllowNanAndInf() {
return allowNanAndInf.getValueAsBoolean();
}
@@ -1782,7 +1778,7 @@
*
* @return
*/
- protected String getEncoding() {
+ public String getEncoding() {
return this.characterEncodingAsString;
}
@@ -2074,7 +2070,7 @@
return this.requireSSL.getValueAsBoolean();
}
- protected boolean getRetainStatementAfterResultSetClose() {
+ public boolean getRetainStatementAfterResultSetClose() {
return this.retainStatementAfterResultSetClose.getValueAsBoolean();
}
@@ -2445,42 +2441,7 @@
}
protected void postInitialization() throws SQLException {
- //
- // Configure logger If the value has been set by the user, then use
- // that, otherwise, autodetect it : JDK1.4 logging,
- // Then fallback to our STDERR logging.
- //
-
- //
- // Yes, this looks goofy (String == instead of .equals),
- // but it's how we tell whether we're using defaults
- // or not, and it survives JNDI/Properties initialization, etc.
- //
-
- if (getLogger() == STANDARD_LOGGER_NAME) {
- String environmentLoggerName = null;
-
- try {
- environmentLoggerName = System
- .getProperty("com.mysql.jdbc.logger");
- } catch (Throwable noAccessToSystemProperties) {
- environmentLoggerName = null;
- }
-
- if (environmentLoggerName != null) {
- setLogger(environmentLoggerName);
- } else {
- try {
- // Are we running on JDK-1.4?
- Class.forName("java.util.logging.Level");
- setLogger(Jdk14Logger.class.getName());
- } catch (Throwable t2) {
- // guess not
- setLogger(STANDARD_LOGGER_NAME);
- }
- }
- }
-
+
// Support 'old' profileSql capitalization
if (this.profileSql.getValueAsObject() != null) {
this.profileSQL.initializeFrom(this.profileSql.getValueAsObject()
@@ -2570,7 +2531,7 @@
* @param allowNanAndInf
* The allowNanAndInf to set.
*/
- protected void setAllowNanAndInf(boolean flag) {
+ public void setAllowNanAndInf(boolean flag) {
this.allowNanAndInf.setValue(flag);
}
@@ -3162,7 +3123,7 @@
this.requireSSL.setValue(property);
}
- protected void setRetainStatementAfterResultSetClose(boolean flag) {
+ public void setRetainStatementAfterResultSetClose(boolean flag) {
this.retainStatementAfterResultSetClose.setValue(flag);
}
@@ -3587,11 +3548,11 @@
return getPreparedStatementCacheSqlLimit();
}
- protected boolean getJdbcCompliantTruncationForReads() {
+ public boolean getJdbcCompliantTruncationForReads() {
return this.jdbcCompliantTruncationForReads;
}
- protected void setJdbcCompliantTruncationForReads(
+ public void setJdbcCompliantTruncationForReads(
boolean jdbcCompliantTruncationForReads) {
this.jdbcCompliantTruncationForReads = jdbcCompliantTruncationForReads;
}
Modified: branches/branch_3_1/connector-j/src/com/mysql/jdbc/PreparedStatement.java
===================================================================
--- branches/branch_3_1/connector-j/src/com/mysql/jdbc/PreparedStatement.java 2006-08-30
00:01:01 UTC (rev 5681)
+++ branches/branch_3_1/connector-j/src/com/mysql/jdbc/PreparedStatement.java 2006-08-30
18:09:53 UTC (rev 5682)
@@ -523,6 +523,10 @@
}
protected String asSql(boolean quoteStreamsAndUnknowns) throws SQLException {
+ if (this.isClosed) {
+ return "statement has been closed, no further internal information available";
+ }
+
StringBuffer buf = new StringBuffer();
try {
@@ -3526,13 +3530,15 @@
StringBuffer buf = new StringBuffer();
buf.append(super.toString());
buf.append(": "); //$NON-NLS-1$
-
+
+
try {
buf.append(asSql());
} catch (SQLException sqlEx) {
buf.append("EXCEPTION: " + sqlEx.toString());
}
+
return buf.toString();
}
}
Modified: branches/branch_3_1/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java
===================================================================
---
branches/branch_3_1/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java 2006-08-30
00:01:01 UTC (rev 5681)
+++
branches/branch_3_1/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java 2006-08-30
18:09:53 UTC (rev 5682)
@@ -337,6 +337,10 @@
protected String asSql(boolean quoteStreamsAndUnknowns) throws SQLException {
+ if (this.isClosed) {
+ return "statement has been closed, no further internal information available";
+ }
+
PreparedStatement pStmtForSub = null;
try {
Modified:
branches/branch_3_1/connector-j/src/testsuite/regression/StatementRegressionTest.java
===================================================================
---
branches/branch_3_1/connector-j/src/testsuite/regression/StatementRegressionTest.java 2006-08-30
00:01:01 UTC (rev 5681)
+++
branches/branch_3_1/connector-j/src/testsuite/regression/StatementRegressionTest.java 2006-08-30
18:09:53 UTC (rev 5682)
@@ -3322,4 +3322,20 @@
closeMemberJDBCResources();
}
}
+
+ /**
+ * Tests Bug#21207 - Driver throws NPE when tracing prepared statements that
+ * have been closed (in asSQL()).
+ *
+ * @throws Exception if the test fails
+ */
+ public void testBug21207() throws Exception {
+ try {
+ this.pstmt = this.conn.prepareStatement("SELECT 1");
+ this.pstmt.close();
+ this.pstmt.toString(); // this used to cause an NPE
+ } finally {
+ closeMemberJDBCResources();
+ }
+ }
}
Modified: branches/branch_5_0/connector-j/CHANGES
===================================================================
--- branches/branch_5_0/connector-j/CHANGES 2006-08-30 00:01:01 UTC (rev 5681)
+++ branches/branch_5_0/connector-j/CHANGES 2006-08-30 18:09:53 UTC (rev 5682)
@@ -230,7 +230,14 @@
- Fixed calling toString() on ResultSetMetaData for driver-generated
(i.e. from DatabaseMetaData method calls, or from getGeneratedKeys())
result sets would raise a NullPointerException.
-
+
+ - Fixed Bug#21207 - Driver throws NPE when tracing prepared statements
+ that have been closed (in asSQL()).
+
+ - Removed logger autodectection altogether, must now specify logger
+ explitly if you want to use a logger other than one that logs
+ to STDERR.
+
05-26-06 - Version 3.1.13
- Fixed BUG#15464 - INOUT parameter does not store IN value.
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/ConnectionProperties.java
===================================================================
---
branches/branch_5_0/connector-j/src/com/mysql/jdbc/ConnectionProperties.java 2006-08-30
00:01:01 UTC (rev 5681)
+++
branches/branch_5_0/connector-j/src/com/mysql/jdbc/ConnectionProperties.java 2006-08-30
18:09:53 UTC (rev 5682)
@@ -564,11 +564,7 @@
private static final ArrayList PROPERTY_LIST = new ArrayList();
- //
- // Yes, this looks goofy, but we're trying to avoid intern()ing here
- //
- private static final String STANDARD_LOGGER_NAME = new String(StandardLogger.class
- .getName().getBytes());
+ private static final String STANDARD_LOGGER_NAME = StandardLogger.class.getName();
protected static final String ZERO_DATETIME_BEHAVIOR_CONVERT_TO_NULL = "convertToNull";
@@ -2532,42 +2528,7 @@
}
protected void postInitialization() throws SQLException {
- //
- // Configure logger If the value has been set by the user, then use
- // that, otherwise, autodetect it : JDK1.4 logging,
- // Then fallback to our STDERR logging.
- //
- //
- // Yes, this looks goofy (String == instead of .equals),
- // but it's how we tell whether we're using defaults
- // or not, and it survives JNDI/Properties initialization, etc.
- //
-
- if (getLogger() == STANDARD_LOGGER_NAME) {
- String environmentLoggerName = null;
-
- try {
- environmentLoggerName = System
- .getProperty("com.mysql.jdbc.logger");
- } catch (Throwable noAccessToSystemProperties) {
- environmentLoggerName = null;
- }
-
- if (environmentLoggerName != null) {
- setLogger(environmentLoggerName);
- } else {
- try {
- // Are we running on JDK-1.4?
- Class.forName("java.util.logging.Level");
- setLogger(Jdk14Logger.class.getName());
- } catch (Throwable t2) {
- // guess not
- setLogger(STANDARD_LOGGER_NAME);
- }
- }
- }
-
// Support 'old' profileSql capitalization
if (this.profileSql.getValueAsObject() != null) {
this.profileSQL.initializeFrom(this.profileSql.getValueAsObject()
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/PreparedStatement.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/PreparedStatement.java 2006-08-30
00:01:01 UTC (rev 5681)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/PreparedStatement.java 2006-08-30
18:09:53 UTC (rev 5682)
@@ -517,6 +517,10 @@
}
protected String asSql(boolean quoteStreamsAndUnknowns) throws SQLException {
+ if (this.isClosed) {
+ return "statement has been closed, no further internal information available";
+ }
+
StringBuffer buf = new StringBuffer();
try {
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java
===================================================================
---
branches/branch_5_0/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java 2006-08-30
00:01:01 UTC (rev 5681)
+++
branches/branch_5_0/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java 2006-08-30
18:09:53 UTC (rev 5682)
@@ -346,6 +346,10 @@
protected String asSql(boolean quoteStreamsAndUnknowns) throws SQLException {
+ if (this.isClosed) {
+ return "statement has been closed, no further internal information available";
+ }
+
PreparedStatement pStmtForSub = null;
try {
Modified:
branches/branch_5_0/connector-j/src/testsuite/regression/StatementRegressionTest.java
===================================================================
---
branches/branch_5_0/connector-j/src/testsuite/regression/StatementRegressionTest.java 2006-08-30
00:01:01 UTC (rev 5681)
+++
branches/branch_5_0/connector-j/src/testsuite/regression/StatementRegressionTest.java 2006-08-30
18:09:53 UTC (rev 5682)
@@ -3382,4 +3382,20 @@
closeMemberJDBCResources();
}
}
+
+ /**
+ * Tests Bug#21207 - Driver throws NPE when tracing prepared statements that
+ * have been closed (in asSQL()).
+ *
+ * @throws Exception if the test fails
+ */
+ public void testBug21207() throws Exception {
+ try {
+ this.pstmt = this.conn.prepareStatement("SELECT 1");
+ this.pstmt.close();
+ this.pstmt.toString(); // this used to cause an NPE
+ } finally {
+ closeMemberJDBCResources();
+ }
+ }
}
Modified: trunk/connector-j/CHANGES
===================================================================
--- trunk/connector-j/CHANGES 2006-08-30 00:01:01 UTC (rev 5681)
+++ trunk/connector-j/CHANGES 2006-08-30 18:09:53 UTC (rev 5682)
@@ -221,7 +221,14 @@
- Fixed calling toString() on ResultSetMetaData for driver-generated
(i.e. from DatabaseMetaData method calls, or from getGeneratedKeys())
result sets would raise a NullPointerException.
-
+
+ - Fixed Bug#21207 - Driver throws NPE when tracing prepared statements
+ that have been closed (in asSQL()).
+
+ - Removed logger autodectection altogether, must now specify logger
+ explitly if you want to use a logger other than one that logs
+ to STDERR.
+
05-26-06 - Version 3.1.13
- Fixed BUG#15464 - INOUT parameter does not store IN value.
@@ -332,7 +339,7 @@
- Fixed BUG#19282 - ResultSet.wasNull() returns incorrect value
when extracting native string from server-side prepared statement
- generated result set.
+ generated result set.
11-30-05 - Version 3.1.12
Modified: trunk/connector-j/src/com/mysql/jdbc/ConnectionProperties.java
===================================================================
--- trunk/connector-j/src/com/mysql/jdbc/ConnectionProperties.java 2006-08-30 00:01:01 UTC
(rev 5681)
+++ trunk/connector-j/src/com/mysql/jdbc/ConnectionProperties.java 2006-08-30 18:09:53 UTC
(rev 5682)
@@ -567,8 +567,7 @@
//
// Yes, this looks goofy, but we're trying to avoid intern()ing here
//
- private static final String STANDARD_LOGGER_NAME = new String(StandardLogger.class
- .getName().getBytes());
+ private static final String STANDARD_LOGGER_NAME = StandardLogger.class.getName();
protected static final String ZERO_DATETIME_BEHAVIOR_CONVERT_TO_NULL = "convertToNull";
@@ -2532,42 +2531,7 @@
}
protected void postInitialization() throws SQLException {
- //
- // Configure logger If the value has been set by the user, then use
- // that, otherwise, autodetect it : JDK1.4 logging,
- // Then fallback to our STDERR logging.
- //
-
- //
- // Yes, this looks goofy (String == instead of .equals),
- // but it's how we tell whether we're using defaults
- // or not, and it survives JNDI/Properties initialization, etc.
- //
-
- if (getLogger() == STANDARD_LOGGER_NAME) {
- String environmentLoggerName = null;
-
- try {
- environmentLoggerName = System
- .getProperty("com.mysql.jdbc.logger");
- } catch (Throwable noAccessToSystemProperties) {
- environmentLoggerName = null;
- }
-
- if (environmentLoggerName != null) {
- setLogger(environmentLoggerName);
- } else {
- try {
- // Are we running on JDK-1.4?
- Class.forName("java.util.logging.Level");
- setLogger(Jdk14Logger.class.getName());
- } catch (Throwable t2) {
- // guess not
- setLogger(STANDARD_LOGGER_NAME);
- }
- }
- }
-
+
// Support 'old' profileSql capitalization
if (this.profileSql.getValueAsObject() != null) {
this.profileSQL.initializeFrom(this.profileSql.getValueAsObject()
Modified: trunk/connector-j/src/com/mysql/jdbc/PreparedStatement.java
===================================================================
--- trunk/connector-j/src/com/mysql/jdbc/PreparedStatement.java 2006-08-30 00:01:01 UTC
(rev 5681)
+++ trunk/connector-j/src/com/mysql/jdbc/PreparedStatement.java 2006-08-30 18:09:53 UTC
(rev 5682)
@@ -516,6 +516,10 @@
}
protected String asSql(boolean quoteStreamsAndUnknowns) throws SQLException {
+ if (this.isClosed) {
+ return "statement has been closed, no further internal information available";
+ }
+
StringBuffer buf = new StringBuffer();
try {
Modified: trunk/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java
===================================================================
--- trunk/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java 2006-08-30 00:01:01
UTC (rev 5681)
+++ trunk/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java 2006-08-30 18:09:53
UTC (rev 5682)
@@ -342,6 +342,10 @@
protected String asSql(boolean quoteStreamsAndUnknowns) throws SQLException {
+ if (this.isClosed) {
+ return "statement has been closed, no further internal information available";
+ }
+
PreparedStatement pStmtForSub = null;
try {
Modified: trunk/connector-j/src/testsuite/regression/StatementRegressionTest.java
===================================================================
--- trunk/connector-j/src/testsuite/regression/StatementRegressionTest.java 2006-08-30
00:01:01 UTC (rev 5681)
+++ trunk/connector-j/src/testsuite/regression/StatementRegressionTest.java 2006-08-30
18:09:53 UTC (rev 5682)
@@ -3382,4 +3382,20 @@
closeMemberJDBCResources();
}
}
+
+ /**
+ * Tests Bug#21207 - Driver throws NPE when tracing prepared statements that
+ * have been closed (in asSQL()).
+ *
+ * @throws Exception if the test fails
+ */
+ public void testBug21207() throws Exception {
+ try {
+ this.pstmt = this.conn.prepareStatement("SELECT 1");
+ this.pstmt.close();
+ this.pstmt.toString(); // this used to cause an NPE
+ } finally {
+ closeMemberJDBCResources();
+ }
+ }
}
| Thread |
|---|
| • Connector/J commit: r5682 - branches/branch_3_1/connector-j branches/branch_3_1/connector-j/src/com/mysql/jdbc branches/branch_3_1/connector-j/src/tes... | mmatthews | 30 Aug |