details:   https://code.openbravo.com/erp/devel/pi/rev/3392fa97aa1c
changeset: 34229:3392fa97aa1c
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Fri Jun 22 10:27:58 2018 +0200
summary:   Fixes bug 38801: Error in TriggerHandler.enable doesnt leave 
triggers disabled

The original fix was not proper, because the DAL connection was being retrieved 
inside a
try-with-resources block, so it was being automatically closed.

diffstat:

 src/org/openbravo/dal/core/TriggerHandler.java |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (18 lines):

diff -r 9edd416002b7 -r 3392fa97aa1c 
src/org/openbravo/dal/core/TriggerHandler.java
--- a/src/org/openbravo/dal/core/TriggerHandler.java    Fri Jun 22 10:51:35 
2018 +0200
+++ b/src/org/openbravo/dal/core/TriggerHandler.java    Fri Jun 22 10:27:58 
2018 +0200
@@ -88,9 +88,11 @@
     Check.isNotNull(sessionStatus.get(),
         "Triggers were not disabled in this session, call disable before 
calling this method");
 
-    Connection con = OBDal.getInstance().getConnection();
-    try (PreparedStatement ps = con.prepareStatement(getEnableStatement())) {
-      ps.execute();
+    try {
+      Connection con = OBDal.getInstance().getConnection();
+      try (PreparedStatement ps = con.prepareStatement(getEnableStatement())) {
+        ps.execute();
+      }
     } catch (Exception e) {
       throw new OBException("Couldn't enable triggers: ", e);
     } finally {

------------------------------------------------------------------------------
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