details:   https://code.openbravo.com/erp/devel/pi/rev/78f84b2b36fc
changeset: 32202:78f84b2b36fc
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Thu May 25 10:32:49 2017 +0200
summary:   fixed bug 36097: dataset fails if it has properties not in target 
system

  Trying to apply a dataset with information for properties not present in 
target
  instance failed.

  Now in this case the property is just ignored and the process continues.

diffstat:

 src/org/openbravo/dal/xml/XMLEntityConverter.java |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r 3510a7bf3601 -r 78f84b2b36fc 
src/org/openbravo/dal/xml/XMLEntityConverter.java
--- a/src/org/openbravo/dal/xml/XMLEntityConverter.java Thu May 25 10:31:59 
2017 +0200
+++ b/src/org/openbravo/dal/xml/XMLEntityConverter.java Thu May 25 10:32:49 
2017 +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) 2008-2015 Openbravo SLU 
+ * All portions are Copyright (C) 2008-2017 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -225,7 +225,12 @@
       try {
         // now parse the property elements
         for (final Element childElement : (List<Element>) 
obElement.elements()) {
-          final Property p = entity.getProperty(childElement.getName());
+          final Property p = entity.getProperty(childElement.getName(), false);
+          if (p == null) {
+            log.warn("Trying to set property " + childElement.getName() + " in 
entity "
+                + entity.getName() + ". Cannot find porperty in entity, 
skipping it.");
+            continue;
+          }
           log.debug(">>> Exporting property " + p.getName());
 
           // TODO: make this option controlled

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