Related to issue 22923: Cursors not closed
authorMartin Taal <martin.taal@openbravo.com>
Wed, 30 Jan 2013 14:27:43 +0100
changeset 19523 b34d87f25d55
parent 19522 d0dbfd0f4d02
child 19524 841c9df2a9d8
Related to issue 22923: Cursors not closed
Solve api issue
src/org/openbravo/erpCommon/ad_process/ApplyModulesCallServlet.java
--- a/src/org/openbravo/erpCommon/ad_process/ApplyModulesCallServlet.java	Wed Jan 30 12:36:06 2013 +0100
+++ b/src/org/openbravo/erpCommon/ad_process/ApplyModulesCallServlet.java	Wed Jan 30 14:27:43 2013 +0100
@@ -146,9 +146,13 @@
         resp.setStatusofstate(defaultState);
     } catch (Exception e) {
     } finally {
-      releasePreparedStatement(ps);
-      releasePreparedStatement(ps2);
-      releasePreparedStatement(ps3);
+      try {
+        releasePreparedStatement(ps);
+        releasePreparedStatement(ps2);
+        releasePreparedStatement(ps3);
+      } catch (SQLException e) {
+        // ignore
+      }
     }
     return resp;
   }
@@ -198,8 +202,12 @@
       // We need to use printStackTrace here because if not, the log will not be shown
       e.printStackTrace();
     } finally {
-      releasePreparedStatement(ps2);
-      releasePreparedStatement(ps3);
+      try {
+        releasePreparedStatement(ps2);
+        releasePreparedStatement(ps3);
+      } catch (SQLException e) {
+        // ignore
+      }
     }
     return resp;
   }
@@ -233,7 +241,11 @@
       // We need to use printStackTrace here because if not, the log will not be shown
       e.printStackTrace();
     } finally {
-      releasePreparedStatement(ps);
+      try {
+        releasePreparedStatement(ps);
+      } catch (SQLException e) {
+        // ignore
+      }
     }
   }
 
@@ -396,23 +408,23 @@
       // We need to use printStackTrace here because if not, the log will not be shown
       e.printStackTrace();
     } finally {
-      releasePreparedStatement(ps);
-      releasePreparedStatement(ps2);
-      releasePreparedStatement(ps3);
-      releasePreparedStatement(ps4);
-      releasePreparedStatement(ps5);
-      releasePreparedStatement(ps6);
-      releasePreparedStatement(ps7);
+      try {
+        releasePreparedStatement(ps);
+        releasePreparedStatement(ps2);
+        releasePreparedStatement(ps3);
+        releasePreparedStatement(ps4);
+        releasePreparedStatement(ps5);
+        releasePreparedStatement(ps6);
+        releasePreparedStatement(ps7);
+      } catch (SQLException e) {
+        // ignore
+      }
     }
   }
 
-  public void releasePreparedStatement(PreparedStatement ps) {
-    try {
-      if (ps != null) {
-        super.releasePreparedStatement(ps);
-      }
-    } catch (SQLException e) {
-      // ignore
+  public void releasePreparedStatement(PreparedStatement ps) throws SQLException {
+    if (ps != null) {
+      super.releasePreparedStatement(ps);
     }
   }
 }