cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject svn commit: r124617 - /cocoon/branches/BRANCH_2_1_X/src/blocks/databases/java/org/apache/cocoon/acting/OraAddAction.java
Date Sat, 08 Jan 2005 03:48:11 GMT
Author: antonio
Date: Fri Jan  7 19:48:10 2005
New Revision: 124617

URL: http://svn.apache.org/viewcvs?view=rev&rev=124617
Log:
Close database resource
Modified:
   cocoon/branches/BRANCH_2_1_X/src/blocks/databases/java/org/apache/cocoon/acting/OraAddAction.java

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/databases/java/org/apache/cocoon/acting/OraAddAction.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/databases/java/org/apache/cocoon/acting/OraAddAction.java?view=diff&rev=124617&p1=cocoon/branches/BRANCH_2_1_X/src/blocks/databases/java/org/apache/cocoon/acting/OraAddAction.java&r1=124616&p2=cocoon/branches/BRANCH_2_1_X/src/blocks/databases/java/org/apache/cocoon/acting/OraAddAction.java&r2=124617
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/databases/java/org/apache/cocoon/acting/OraAddAction.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/databases/java/org/apache/cocoon/acting/OraAddAction.java
Fri Jan  7 19:48:10 2005
@@ -26,6 +26,7 @@
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.sql.Statement;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
@@ -91,21 +92,21 @@
 
                 if ("manual".equals(mode)) {
                     String selectQuery = this.getSelectQuery(keys[i]);
+                    Statement stmt =null;
                     ResultSet set = null;
                     try {
-                        set = conn.createStatement().executeQuery(selectQuery);
+                        stmt = conn.createStatement();
+                        set = stmt.executeQuery(selectQuery);
                         set.next();
                         int value = set.getInt("maxid") + 1;
-    
                         statement.setInt(currentIndex, value);
-    
                         request.setAttribute(keys[i].getAttribute("param"), String.valueOf(value));
                     } catch (SQLException sqle){
-                        getLogger().warn("There was an error closing the ResultSet", sqle);
+                        getLogger().warn("There was an error retrieving the next key while
inserting on the database", sqle);
                         throw sqle;
                     } finally {
                         set.close();
-                        set.getStatement().close();
+                        stmt.close();
                         currentIndex++;
                     }
                 } else if ("form".equals(mode)) {

Mime
View raw message