details:   https://code.openbravo.com/erp/devel/pi/rev/b6c63f6d3908
changeset: 32276:b6c63f6d3908
user:      Inigo Sanchez <inigo.sanchez <at> openbravo.com>
date:      Thu Jun 08 12:09:54 2017 +0200
summary:   Related with issue 36109: deleteClient method cleanup

diffstat:

 src/org/openbravo/service/system/SystemService.java |  34 +++-----------------
 1 files changed, 6 insertions(+), 28 deletions(-)

diffs (49 lines):

diff -r 660abc9cadcf -r b6c63f6d3908 
src/org/openbravo/service/system/SystemService.java
--- a/src/org/openbravo/service/system/SystemService.java       Thu Jun 08 
11:29:36 2017 +0200
+++ b/src/org/openbravo/service/system/SystemService.java       Thu Jun 08 
12:09:54 2017 +0200
@@ -330,39 +330,17 @@
           sqlCommands.add(sql);
         }
       }
+
+      sqlCommands.add("DELETE FROM ad_preference p where 
visibleat_client_id=?");
+      sqlCommands.add("DELETE FROM obuiapp_uipersonalization p where 
visibleat_client_id=?");
+
       for (String command : sqlCommands) {
-        PreparedStatement ps = null;
-        try {
-          ps = con.prepareStatement(command);
+        try (PreparedStatement ps = con.prepareStatement(command)) {
           ps.setString(1, clientId);
           ps.executeUpdate();
-        } finally {
-          if (ps != null && !ps.isClosed()) {
-            ps.close();
-          }
         }
       }
-      PreparedStatement stpref = null;
-      try {
-        stpref = con.prepareStatement("DELETE FROM ad_preference p where 
visibleat_client_id=?");
-        stpref.setString(1, clientId);
-        stpref.executeUpdate();
-      } finally {
-        if (stpref != null && !stpref.isClosed()) {
-          stpref.close();
-        }
-      }
-      PreparedStatement stpers = null;
-      try {
-        stpers = con
-            .prepareStatement("DELETE FROM obuiapp_uipersonalization p where 
visibleat_client_id=?");
-        stpers.setString(1, clientId);
-        stpers.executeUpdate();
-      } finally {
-        if (stpers != null && !stpers.isClosed()) {
-          stpers.close();
-        }
-      }
+
       con.commit();
       OBDal.getInstance().commitAndClose();
       enableConstraints(platform);

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to