Author: kfujino
Date: Wed Jul 20 08:45:09 2016
New Revision: 1753467
URL: http://svn.apache.org/viewvc?rev=1753467&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=59849
Ensure that the connection verification is executed by initSQL (if required) if
the borrowing PooledConnection has not been initialized.
Modified:
tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
Modified:
tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1753467&r1=1753466&r2=1753467&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
(original)
+++
tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
Wed Jul 20 08:45:09 2016
@@ -765,20 +765,9 @@ public class ConnectionPool {
}
if (!con.isDiscarded() && !con.isInitialized()) {
- //attempt to connect
- try {
- con.connect();
- } catch (Exception x) {
- release(con);
- setToNull = true;
- if (x instanceof SQLException) {
- throw (SQLException)x;
- } else {
- SQLException ex = new SQLException(x.getMessage());
- ex.initCause(x);
- throw ex;
- }
- }
+ //here it states that the connection not discarded, but the
connection is null
+ //don't attempt a connect here. It will be done during the
reconnect.
+ usercheck = false;
}
if (usercheck) {
@@ -802,7 +791,10 @@ public class ConnectionPool {
//the connection shouldn't have to poll again.
try {
con.reconnect();
- if (con.validate(PooledConnection.VALIDATE_INIT)) {
+ int validationMode = getPoolProperties().isTestOnConnect() ||
getPoolProperties().getInitSQL()!=null ?
+ PooledConnection.VALIDATE_INIT :
+ PooledConnection.VALIDATE_BORROW;
+ if (con.validate(validationMode)) {
//set the timestamp
con.setTimestamp(now);
if (getPoolProperties().isLogAbandoned()) {
Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1753467&r1=1753466&r2=1753467&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Wed Jul 20 08:45:09 2016
@@ -170,6 +170,11 @@
been scheduled. (kfujino)
</fix>
<fix>
+ <bug>59849</bug>: Ensure that the connection verification is executed
by
+ <code>initSQL</code> (if required) if the borrowing
+ <code>PooledConnection</code> has not been initialized. (kfujino)
+ </fix>
+ <fix>
<bug>59850</bug>: Ensure that the <code>ResultSet</code> is closed when
enabling the <code>StatementCache</code> interceptor. (kfujino)
</fix>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]