[logs] don't execute truncate if there is no tables to truncate
authorAsier Lostalé <asier.lostale@openbravo.com>
Thu, 12 Feb 2015 11:28:35 +0100
changeset 26007 0b04430510b2
parent 26006 d31a4c9419b0
child 26008 a93d05b6eb13
[logs] don't execute truncate if there is no tables to truncate
modules/org.openbravo.utility.cleanup.log/src/org/openbravo/utility/cleanup/log/LogCleanUpProcess.java
--- a/modules/org.openbravo.utility.cleanup.log/src/org/openbravo/utility/cleanup/log/LogCleanUpProcess.java	Thu Feb 12 11:27:35 2015 +0100
+++ b/modules/org.openbravo.utility.cleanup.log/src/org/openbravo/utility/cleanup/log/LogCleanUpProcess.java	Thu Feb 12 11:28:35 2015 +0100
@@ -143,6 +143,11 @@
   }
 
   private void truncateTables(Set<String> tablesToTruncate, ProcessLogger bgLogger) {
+    if (tablesToTruncate.isEmpty()) {
+      // nothing to do
+      return;
+    }
+
     Connection con = OBDal.getInstance().getConnection(false);
     PreparedStatement ps = null;
     String logMsg;