details:   https://code.openbravo.com/erp/devel/pi/rev/6d9ad2597c25
changeset: 16617:6d9ad2597c25
user:      Sandra Huguet <sandra.huguet <at> openbravo.com>
date:      Wed May 23 13:10:01 2012 +0200
summary:   Fixed bug 20578, Fixed bug 20559, Fixed bug 20562
Add logic to avoid NullPointerException and NumberFormatException

details:   https://code.openbravo.com/erp/devel/pi/rev/83eeba217754
changeset: 16618:83eeba217754
user:      Mikel Irurita <mikel.irurita <at> openbravo.com>
date:      Thu May 24 16:53:59 2012 +0200
summary:   Related to issue 20562: code review

diffstat:

 src/org/openbravo/common/actionhandler/RMInOutPickEditLines.java    |  6 ++++--
 src/org/openbravo/common/actionhandler/RMShipmentPickEditLines.java |  6 ++++--
 src/org/openbravo/common/actionhandler/SRMOPickEditLines.java       |  9 
+++++++--
 3 files changed, 15 insertions(+), 6 deletions(-)

diffs (79 lines):

diff -r 744f12f0a11c -r 83eeba217754 
src/org/openbravo/common/actionhandler/RMInOutPickEditLines.java
--- a/src/org/openbravo/common/actionhandler/RMInOutPickEditLines.java  Thu May 
24 16:51:08 2012 +0200
+++ b/src/org/openbravo/common/actionhandler/RMInOutPickEditLines.java  Thu May 
24 16:53:59 2012 +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-2012 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -66,7 +66,9 @@
   }
 
   private boolean cleanInOutLines(ShipmentInOut inOut) {
-    if (inOut.getMaterialMgmtShipmentInOutLineList().isEmpty()) {
+    if (inOut == null) {
+      return false;
+    } else if (inOut.getMaterialMgmtShipmentInOutLineList().isEmpty()) {
       // nothing to delete.
       return true;
     }
diff -r 744f12f0a11c -r 83eeba217754 
src/org/openbravo/common/actionhandler/RMShipmentPickEditLines.java
--- a/src/org/openbravo/common/actionhandler/RMShipmentPickEditLines.java       
Thu May 24 16:51:08 2012 +0200
+++ b/src/org/openbravo/common/actionhandler/RMShipmentPickEditLines.java       
Thu May 24 16:53:59 2012 +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-2012 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -67,7 +67,9 @@
   }
 
   private boolean cleanInOutLines(ShipmentInOut inOut) {
-    if (inOut.getMaterialMgmtShipmentInOutLineList().isEmpty()) {
+    if (inOut == null) {
+      return false;
+    } else if (inOut.getMaterialMgmtShipmentInOutLineList().isEmpty()) {
       if (inOut.getOrderReference() == null) {
         setRefNo = true;
       }
diff -r 744f12f0a11c -r 83eeba217754 
src/org/openbravo/common/actionhandler/SRMOPickEditLines.java
--- a/src/org/openbravo/common/actionhandler/SRMOPickEditLines.java     Thu May 
24 16:51:08 2012 +0200
+++ b/src/org/openbravo/common/actionhandler/SRMOPickEditLines.java     Thu May 
24 16:53:59 2012 +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-2012 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -96,7 +96,9 @@
   }
 
   private boolean cleanOrderLines(Order order) {
-    if (order.getOrderLineList().isEmpty()) {
+    if (order == null) {
+      return false;
+    } else if (order.getOrderLineList().isEmpty()) {
       // nothing to delete.
       return true;
     }
@@ -123,6 +125,9 @@
     for (long i = 0; i < selectedLines.length(); i++) {
       JSONObject selectedLine = selectedLines.getJSONObject((int) i);
       log.debug(selectedLine);
+      if ("null".equals(selectedLine.getString("returned"))) {
+        continue;
+      }
       OrderLine newOrderLine = OBProvider.getInstance().get(OrderLine.class);
       newOrderLine.setSalesOrder(order);
       newOrderLine.setOrganization(order.getOrganization());

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