details:   https://code.openbravo.com/erp/devel/pi/rev/1596542c21af
changeset: 35804:1596542c21af
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Fri May 17 11:14:19 2019 +0200
summary:   fixed bug 40897: broken system if tying to create a ws row with 
unlimited WS

  System became unreacheable after trtying to create/update a record through WS
  as first action after Tomcat restart having unlimited WS access license.

  This occurred because TreeTablesEventHandler initialization assumed to be in
  admin mode. As unlimited access license does not do any DB modification on 
login,
  which is what occurs in standard login and with limited acess licenses, first
  flush with dirty entities causes TreeTablesEventHandler init to fail in a
  unrecoverable manner.

  Now TreeTablesEventHandler is initialized in admin mode to prevent this case.

diffstat:

 
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/TreeTablesEventHandler.java
 |  19 ++++++---
 1 files changed, 12 insertions(+), 7 deletions(-)

diffs (29 lines):

diff -r 59e2bd0cc7fa -r 1596542c21af 
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/TreeTablesEventHandler.java
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/TreeTablesEventHandler.java
   Fri May 17 09:49:39 2019 +0200
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/TreeTablesEventHandler.java
   Fri May 17 11:14:19 2019 +0200
@@ -164,13 +164,18 @@
   }
 
   private static Entity[] getTreeTables() {
-    OBCriteria<Table> treeTablesCriteria = 
OBDal.getInstance().createCriteria(Table.class);
-    treeTablesCriteria.add(Restrictions.eq(Table.PROPERTY_ISTREE, true));
-    List<Table> treeTableList = treeTablesCriteria.list();
-    ArrayList<Entity> entityArray = new ArrayList<>();
-    for (Table treeTable : treeTableList) {
-      
entityArray.add(ModelProvider.getInstance().getEntityByTableId(treeTable.getId()));
+    OBContext.setAdminMode(true);
+    try {
+      OBCriteria<Table> treeTablesCriteria = 
OBDal.getInstance().createCriteria(Table.class);
+      treeTablesCriteria.add(Restrictions.eq(Table.PROPERTY_ISTREE, true));
+      List<Table> treeTableList = treeTablesCriteria.list();
+      ArrayList<Entity> entityArray = new ArrayList<>();
+      for (Table treeTable : treeTableList) {
+        
entityArray.add(ModelProvider.getInstance().getEntityByTableId(treeTable.getId()));
+      }
+      return entityArray.toArray(new Entity[entityArray.size()]);
+    } finally {
+      OBContext.restorePreviousMode();
     }
-    return entityArray.toArray(new Entity[entityArray.size()]);
   }
 }


_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to