db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r367022 - in /db/ddlutils/trunk/src/java/org/apache/ddlutils/platform: ModelBasedResultSetIterator.java PlatformImplBase.java
Date Sun, 08 Jan 2006 12:05:20 GMT
Author: tomdz
Date: Sun Jan  8 04:05:15 2006
New Revision: 367022

URL: http://svn.apache.org/viewcvs?rev=367022&view=rev
Log:
Fixed connection leak

Modified:
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/ModelBasedResultSetIterator.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/ModelBasedResultSetIterator.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/ModelBasedResultSetIterator.java?rev=367022&r1=367021&r2=367022&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/ModelBasedResultSetIterator.java
(original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/ModelBasedResultSetIterator.java
Sun Jan  8 04:05:15 2006
@@ -302,19 +302,21 @@
     {
         if (_cleanUpAfterFinish && (_resultSet != null))
         {
+            Connection conn = null;
             try
             {
-                Statement  stmt = _resultSet.getStatement();
-                Connection conn = stmt.getConnection();
+                Statement stmt = _resultSet.getStatement();
+
+                conn = stmt.getConnection();
 
                 // also closes the resultset
-                stmt.close();
-                conn.close();
+                _platform.closeStatement(stmt);
             }
             catch (SQLException ex)
             {
                 // we ignore it
             }
+            _platform.returnConnection(conn);
             _resultSet = null;
         }
     }

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java?rev=367022&r1=367021&r2=367022&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/PlatformImplBase.java Sun Jan
 8 04:05:15 2006
@@ -1416,7 +1416,16 @@
      */    
     public Database readModelFromDatabase(String name) throws DynaSqlException
     {
-        return readModelFromDatabase(borrowConnection(), name);
+        Connection connection = borrowConnection();
+
+        try
+        {
+            return readModelFromDatabase(connection, name);
+        }
+        finally
+        {
+            returnConnection(connection);
+        }
     }
 
     /**



Mime
View raw message