db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r370489 - /db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java
Date Thu, 19 Jan 2006 14:55:03 GMT
Author: mvdb
Date: Thu Jan 19 06:55:00 2006
New Revision: 370489

URL: http://svn.apache.org/viewcvs?rev=370489&view=rev
Log:
Close statement when something goes wrong.

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

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java?rev=370489&r1=370488&r2=370489&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/JdbcModelReader.java Thu Jan 19
06:55:00 2006
@@ -953,17 +953,27 @@
         }
         query.append(" WHERE 1 = 0");
         
-        Statement         stmt       = getConnection().createStatement();
-        ResultSet         rs         = stmt.executeQuery(query.toString());
-        ResultSetMetaData rsMetaData = rs.getMetaData();
-    
-        for (int idx = 0; idx < columnsToCheck.length; idx++)
+        Statement         stmt       = null;
+        try
         {
-            if (rsMetaData.isAutoIncrement(idx + 1))
+            stmt = getConnection().createStatement();
+            ResultSet         rs         = stmt.executeQuery(query.toString());
+            ResultSetMetaData rsMetaData = rs.getMetaData();
+        
+            for (int idx = 0; idx < columnsToCheck.length; idx++)
             {
-                columnsToCheck[idx].setAutoIncrement(true);
+                if (rsMetaData.isAutoIncrement(idx + 1))
+                {
+                    columnsToCheck[idx].setAutoIncrement(true);
+                }
+            }
+        }
+        finally
+        {
+            if (stmt != null)
+            {
+                stmt.close();
             }
         }
-        stmt.close();
     }
 }



Mime
View raw message