details:   https://code.openbravo.com/erp/devel/pi/rev/f94acbb414d4
changeset: 16681:f94acbb414d4
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Tue May 29 08:46:02 2012 +0200
summary:   fixed bug 20625: Set admin mode also to check if refresh is needed

diffstat:

 src/org/openbravo/erpCommon/obps/ActivationKey.java |  37 ++++++++++----------
 1 files changed, 19 insertions(+), 18 deletions(-)

diffs (54 lines):

diff -r 0ed463f70606 -r f94acbb414d4 
src/org/openbravo/erpCommon/obps/ActivationKey.java
--- a/src/org/openbravo/erpCommon/obps/ActivationKey.java       Tue May 29 
03:26:00 2012 +0200
+++ b/src/org/openbravo/erpCommon/obps/ActivationKey.java       Tue May 29 
08:46:02 2012 +0200
@@ -267,18 +267,13 @@
    * Reloads ActivationKey instance from information in DB.
    */
   public static synchronized ActivationKey reload() {
-    OBContext.setAdminMode();
-    try {
-      ActivationKey ak = getInstance();
-      org.openbravo.model.ad.system.System sys = OBDal.getInstance().get(
-          org.openbravo.model.ad.system.System.class, "0");
-      ak.loadInfo(sys.getActivationKey());
-      ak.loadRestrictions();
-      ak.lastUpdateTimestamp = sys.getUpdated();
-      return ak;
-    } finally {
-      OBContext.restorePreviousMode();
-    }
+    ActivationKey ak = getInstance();
+    org.openbravo.model.ad.system.System sys = OBDal.getInstance().get(
+        org.openbravo.model.ad.system.System.class, "0");
+    ak.loadInfo(sys.getActivationKey());
+    ak.loadRestrictions();
+    ak.lastUpdateTimestamp = sys.getUpdated();
+    return ak;
   }
 
   /**
@@ -1317,12 +1312,18 @@
           maxUsers = 0L;
         }
       }
-
-      // Reload from DB if it was modified from outside
-      if (lastUpdateTimestamp == null
-          || !lastUpdateTimestamp.equals(OBDal.getInstance()
-              .get(org.openbravo.model.ad.system.System.class, 
"0").getUpdated())) {
-        instance = ActivationKey.reload();
+      OBContext.setAdminMode();
+      try {
+        // Reload from DB if it was modified from outside
+        if (lastUpdateTimestamp == null
+            || !lastUpdateTimestamp.equals(OBDal.getInstance()
+                .get(org.openbravo.model.ad.system.System.class, 
"0").getUpdated())) {
+          instance = ActivationKey.reload();
+        }
+      } catch (Exception e) {
+        log.error("Error checking if activation key should be refreshed", e);
+      } finally {
+        OBContext.restorePreviousMode();
       }
     }
   }

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to