You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by eb...@apache.org on 2007/04/13 23:30:09 UTC

svn commit: r528676 - in /jakarta/commons/proper/configuration/trunk: src/java/org/apache/commons/configuration/DatabaseConfiguration.java xdocs/changes.xml

Author: ebourg
Date: Fri Apr 13 14:30:08 2007
New Revision: 528676

URL: http://svn.apache.org/viewvc?view=rev&rev=528676
Log:
Fixed DatabaseConfiguration to ensure the connection is properly closed

Modified:
    jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/DatabaseConfiguration.java
    jakarta/commons/proper/configuration/trunk/xdocs/changes.xml

Modified: jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/DatabaseConfiguration.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/DatabaseConfiguration.java?view=diff&rev=528676&r1=528675&r2=528676
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/DatabaseConfiguration.java (original)
+++ jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/DatabaseConfiguration.java Fri Apr 13 14:30:08 2007
@@ -139,16 +139,15 @@
             List results = new ArrayList();
             while (rs.next())
             {
-                Object val = rs.getObject(valueColumn);
+                Object value = rs.getObject(valueColumn);
                 if (isDelimiterParsingDisabled())
                 {
-                    results.add(val);
+                    results.add(value);
                 }
                 else
                 {
                     // Split value if it containts the list delimiter
-                    CollectionUtils.addAll(results, PropertyConverter
-                            .toIterator(val, getListDelimiter()));
+                    CollectionUtils.addAll(results, PropertyConverter.toIterator(value, getListDelimiter()));
                 }
             }
 
@@ -163,7 +162,7 @@
         }
         finally
         {
-            closeQuietly(conn, pstmt);
+            close(conn, pstmt);
         }
 
         return result;
@@ -218,7 +217,7 @@
         finally
         {
             // clean up
-            closeQuietly(conn, pstmt);
+            close(conn, pstmt);
         }
     }
 
@@ -299,7 +298,7 @@
         finally
         {
             // clean up
-            closeQuietly(conn, pstmt);
+            close(conn, pstmt);
         }
 
         return empty;
@@ -352,7 +351,7 @@
         finally
         {
             // clean up
-            closeQuietly(conn, pstmt);
+            close(conn, pstmt);
         }
 
         return found;
@@ -400,7 +399,7 @@
         finally
         {
             // clean up
-            closeQuietly(conn, pstmt);
+            close(conn, pstmt);
         }
     }
 
@@ -443,7 +442,7 @@
         finally
         {
             // clean up
-            closeQuietly(conn, pstmt);
+            close(conn, pstmt);
         }
     }
 
@@ -496,7 +495,7 @@
         finally
         {
             // clean up
-            closeQuietly(conn, pstmt);
+            close(conn, pstmt);
         }
 
         return keys.iterator();
@@ -534,7 +533,7 @@
      * @param conn The database connection to close
      * @param stmt The statement to close
      */
-    private void closeQuietly(Connection conn, Statement stmt)
+    private void close(Connection conn, Statement stmt)
     {
         try
         {
@@ -542,6 +541,14 @@
             {
                 stmt.close();
             }
+        }
+        catch (SQLException e)
+        {
+            getLogger().error("An error occured on closing the statement", e);
+        }
+        
+        try
+        {
             if (conn != null)
             {
                 conn.close();
@@ -549,7 +556,7 @@
         }
         catch (SQLException e)
         {
-            getLogger().error(e.getMessage(), e);
+            getLogger().error("An error occured on closing the connection", e);
         }
     }
 }

Modified: jakarta/commons/proper/configuration/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/configuration/trunk/xdocs/changes.xml?view=diff&rev=528676&r1=528675&r2=528676
==============================================================================
--- jakarta/commons/proper/configuration/trunk/xdocs/changes.xml (original)
+++ jakarta/commons/proper/configuration/trunk/xdocs/changes.xml Fri Apr 13 14:30:08 2007
@@ -23,6 +23,10 @@
 
   <body>
     <release version="1.5-SNAPSHOT" date="in SVN" description="">
+      <action dev="ebourg" type="fix" issue="CONFIGURATION-180">
+        Fixed a potential issue in DatabaseConfiguration where an error on
+        closing a statement would prevent the connection from being closed.
+      </action>
       <action dev="ebourg" type="add" issue="CONFIGURATION-261">
         Date objects are now supported in ASCII plist files.
       </action>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org