Fixes issue 23841: ScrollableResults objects are closed after being used
authorAugusto Mauch <augusto.mauch@openbravo.com>
Fri, 17 May 2013 13:59:18 +0200
changeset 20397 f7e6400fa814
parent 20396 ff002e948602
child 20398 2f11b5d67c9a
Fixes issue 23841: ScrollableResults objects are closed after being used
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/AcctSchemaEventHandler.java
modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java
modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/CustomQuerySelectorDatasource.java
src/org/openbravo/costing/CostingMigrationProcess.java
src/org/openbravo/costing/CostingRuleProcess.java
src/org/openbravo/erpCommon/ad_actionButton/MRPManufacturingPlanProcess.java
src/org/openbravo/erpCommon/ad_process/MRPPurchaseCreateReservations.java
src/org/openbravo/erpCommon/utility/WindowTree.java
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/AcctSchemaEventHandler.java	Fri May 17 11:43:34 2013 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/AcctSchemaEventHandler.java	Fri May 17 13:59:18 2013 +0200
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2012 Openbravo SLU
+ * All portions are Copyright (C) 2012-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -55,7 +55,8 @@
     return entities;
   }
 
-  public void onUpdate(@Observes EntityUpdateEvent event) {
+  public void onUpdate(@Observes
+  EntityUpdateEvent event) {
     if (!isValidEvent(event)) {
       return;
     }
@@ -168,6 +169,7 @@
       // }
       // i++;
     }
+    elementvalues.close();
   }
 
   private boolean getAccountSign(String accountType, boolean assetPositive,
--- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java	Fri May 17 11:43:34 2013 +0200
+++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java	Fri May 17 13:59:18 2013 +0200
@@ -334,6 +334,7 @@
         log.debug("clearing in record " + i + " elapsed time " + (System.currentTimeMillis() - t));
       }
     }
+    scrollableResults.close();
     log.debug("Fetch took " + (System.currentTimeMillis() - t) + " ms");
   }
 
--- a/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/CustomQuerySelectorDatasource.java	Fri May 17 11:43:34 2013 +0200
+++ b/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/CustomQuerySelectorDatasource.java	Fri May 17 13:59:18 2013 +0200
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2011 Openbravo SLU
+ * All portions are Copyright (C) 2011-2013 Openbravo SLU
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -109,6 +109,7 @@
             OBDal.getInstance().getSession().clear();
           }
         }
+        queryResults.close();
         if (startRow < endRow) {
           if (queryListSize < endRow) {
             totalRows = queryListSize;
--- a/src/org/openbravo/costing/CostingMigrationProcess.java	Fri May 17 11:43:34 2013 +0200
+++ b/src/org/openbravo/costing/CostingMigrationProcess.java	Fri May 17 13:59:18 2013 +0200
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2012 Openbravo SLU
+ * All portions are Copyright (C) 2012-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -288,6 +288,7 @@
             OBDal.getInstance().getSession().clear();
           }
         }
+        legacyCosts.close();
         SessionHandler.getInstance().commitAndStart();
       }
     }
@@ -322,6 +323,7 @@
       }
       i++;
     }
+    costs.close();
   }
 
   private void createRules() throws Exception {
@@ -426,6 +428,7 @@
       }
       i++;
     }
+    icls.close();
 
     OBDal.getInstance().flush();
     insertTrxCosts();
@@ -609,6 +612,7 @@
       }
       i++;
     }
+    trxs.close();
 
     log4j.debug("****** UpdateTrxLegacyCosts updated:" + i);
   }
@@ -653,6 +657,7 @@
       }
       i++;
     }
+    trxs.close();
     log4j.debug("****** updateWithCeroRemainingTrx updated:" + i);
   }
 
--- a/src/org/openbravo/costing/CostingRuleProcess.java	Fri May 17 11:43:34 2013 +0200
+++ b/src/org/openbravo/costing/CostingRuleProcess.java	Fri May 17 13:59:18 2013 +0200
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2012 Openbravo SLU
+ * All portions are Copyright (C) 2012-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -177,7 +177,8 @@
     where.append("   and p." + Product.PROPERTY_ORGANIZATION + ".id in (:porgs)");
     where.append("   and exists (select 1 from " + MaterialTransaction.ENTITY_NAME);
     where.append("     where " + MaterialTransaction.PROPERTY_PRODUCT + " = p");
-    where.append("      and " + MaterialTransaction.PROPERTY_ORGANIZATION + " .id in (:childOrgs))");
+    where
+        .append("      and " + MaterialTransaction.PROPERTY_ORGANIZATION + " .id in (:childOrgs))");
 
     OBQuery<Product> pQry = OBDal.getInstance().createQuery(Product.class, where.toString());
     pQry.setFilterOnReadableOrganization(false);
@@ -266,6 +267,7 @@
       }
       i++;
     }
+    trxs.close();
   }
 
   @Deprecated
@@ -316,6 +318,7 @@
       }
       i++;
     }
+    stockLines.close();
     // Process closing physical inventories.
     for (CostingRuleInit cri : rule.getCostingRuleInitList()) {
       new InventoryCountProcess().processInventory(cri.getCloseInventory());
@@ -549,5 +552,6 @@
         OBDal.getInstance().getSession().clear();
       }
     }
+    trxs.close();
   }
 }
--- a/src/org/openbravo/erpCommon/ad_actionButton/MRPManufacturingPlanProcess.java	Fri May 17 11:43:34 2013 +0200
+++ b/src/org/openbravo/erpCommon/ad_actionButton/MRPManufacturingPlanProcess.java	Fri May 17 13:59:18 2013 +0200
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2012 Openbravo SLU
+ * All portions are Copyright (C) 2012-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -84,7 +84,7 @@
           OBDal.getInstance().getSession().clear();
         }
       }
-
+      linesToUpdate.close();
       log4j.debug("Call MRP_Run_Initialize process");
       // v_ResultStr:='Initialize';
       // MRP_RUN_INITIALIZE(v_User_ID, v_Org_ID, v_Client_ID, v_Record_ID, v_Planner_ID,
--- a/src/org/openbravo/erpCommon/ad_process/MRPPurchaseCreateReservations.java	Fri May 17 11:43:34 2013 +0200
+++ b/src/org/openbravo/erpCommon/ad_process/MRPPurchaseCreateReservations.java	Fri May 17 13:59:18 2013 +0200
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2012 Openbravo SLU 
+ * All portions are Copyright (C) 2012-2013 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -152,6 +152,8 @@
         OBDal.getInstance().getSession().clear();
       }
     }
+    outgoingRLs.close();
+    outgoingRLs.close();
     OBError message = new OBError();
     message.setType("Success");
     message.setTitle(OBMessageUtils.messageBD("Success"));
--- a/src/org/openbravo/erpCommon/utility/WindowTree.java	Fri May 17 11:43:34 2013 +0200
+++ b/src/org/openbravo/erpCommon/utility/WindowTree.java	Fri May 17 13:59:18 2013 +0200
@@ -266,6 +266,7 @@
             OBDal.getInstance().getSession().clear();
           }
         }
+        entityData.close();
       }
 
       for (WindowTreeData elem : subList) {