details:   https://code.openbravo.com/erp/devel/pi/rev/28cc0cfb94b4
changeset: 34222:28cc0cfb94b4
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Thu Jun 21 17:57:27 2018 +0200
summary:   Fixes bug 38801: Error in TriggerHandler.enable doesnt leave 
triggers disabled

The problem was that if the flush indie TriggerHandler.enable (invoked when 
retrieving DAL's connection) failed, the clear method was not
invoked, and the ThreadLocal was not reset. The next time the thread was 
reused, it would work with disabled triggers.

Now that doesn't happen anymore because the flush is done inside the try block.

diffstat:

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

diffs (14 lines):

diff -r 5ec5054e4cff -r 28cc0cfb94b4 
src/org/openbravo/dal/core/TriggerHandler.java
--- a/src/org/openbravo/dal/core/TriggerHandler.java    Mon Jun 18 18:13:28 
2018 +0200
+++ b/src/org/openbravo/dal/core/TriggerHandler.java    Thu Jun 21 17:57:27 
2018 +0200
@@ -88,8 +88,8 @@
     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())) {
+    try (Connection con = OBDal.getInstance().getConnection();
+        PreparedStatement ps = con.prepareStatement(getEnableStatement())) {
       ps.execute();
     } catch (Exception e) {
       throw new OBException("Couldn't enable triggers: ", e);

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