details:   https://code.openbravo.com/erp/devel/pi/rev/6c462af756e8
changeset: 29987:6c462af756e8
user:      Gorka Ion Damián <gorkaion.damian <at> openbravo.com>
date:      Mon Sep 05 12:36:52 2016 +0200
summary:   Related to issue 33210.Do not commit import entry creation.

If the ImportEntry commits and close the session the AddProducts handler fails
with a NPE when trying to close the session again.

diffstat:

 src/org/openbravo/event/ProductCharacteristicValueEventHandler.java |  7 
++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diffs (26 lines):

diff -r cd08dd7274e3 -r 6c462af756e8 
src/org/openbravo/event/ProductCharacteristicValueEventHandler.java
--- a/src/org/openbravo/event/ProductCharacteristicValueEventHandler.java       
Fri Sep 02 12:26:35 2016 +0000
+++ b/src/org/openbravo/event/ProductCharacteristicValueEventHandler.java       
Mon Sep 05 12:36:52 2016 +0200
@@ -89,12 +89,9 @@
     if (productList == null || productList.isEmpty() || 
event.getTransaction().wasRolledBack()) {
       return;
     }
-    JSONArray productIds = new JSONArray();
-    for (String productId : productList) {
-      productIds.put(productId);
-    }
     JSONObject entryJson = new JSONObject();
     try {
+      JSONArray productIds = new JSONArray(productList);
       entryJson.put("productIds", productIds);
     } catch (JSONException ignore) {
     }
@@ -102,7 +99,7 @@
       SessionHandler.getInstance().beginNewTransaction();
     }
     importEntryManager.createImportEntry(SequenceIdData.getUUID(), 
"VariantChDescUpdate",
-        entryJson.toString());
+        entryJson.toString(), false);
   }
 
   private void addProductToList(ProductCharacteristicValue pchv) {

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

Reply via email to