You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by rw...@apache.org on 2003/03/06 16:10:19 UTC
cvs commit: jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/cpdsadapter PooledConnectionImpl.java
rwaldhoff 2003/03/06 07:10:19
Modified: dbcp/src/java/org/apache/commons/dbcp/cpdsadapter
PooledConnectionImpl.java
Log:
Make sure connection is closed in close(), even if there is no pstmtPool.
This closes bug 17200 <http://issues.apache.org/bugzilla/show_bug.cgi?id=17200>
Thanks Remke.
Revision Changes Path
1.3 +16 -13 jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/cpdsadapter/PooledConnectionImpl.java
Index: PooledConnectionImpl.java
===================================================================
RCS file: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/cpdsadapter/PooledConnectionImpl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PooledConnectionImpl.java 8 Nov 2002 18:51:07 -0000 1.2
+++ PooledConnectionImpl.java 6 Mar 2003 15:10:19 -0000 1.3
@@ -148,9 +148,9 @@
{
assertOpen();
isClosed = true;
- if (pstmtPool != null)
+ try
{
- try
+ if (pstmtPool != null)
{
try
{
@@ -159,20 +159,23 @@
finally
{
pstmtPool = null;
- connection.close();
}
}
- catch (Exception e)
+ }
+ catch (Exception e)
+ {
+ if (e instanceof RuntimeException)
{
- if (e instanceof RuntimeException)
- {
- throw (RuntimeException)e;
- }
- else
- {
- throw new SQLException(e.getMessage());
- }
+ throw (RuntimeException)e;
+ }
+ else
+ {
+ throw new SQLException(e.getMessage());
}
+ }
+ finally
+ {
+ connection.close();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org