You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by nm...@apache.org on 2022/06/17 08:28:10 UTC

[ofbiz-framework] branch release22.01 updated: Fixed: Backport ProductWorker getBoolean logic update (OFBIZ-12609) (OFBIZ-12649)

This is an automated email from the ASF dual-hosted git repository.

nmalin pushed a commit to branch release22.01
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/release22.01 by this push:
     new 7bbabc140b Fixed: Backport ProductWorker getBoolean logic update (OFBIZ-12609) (OFBIZ-12649)
7bbabc140b is described below

commit 7bbabc140b0059775835f8c82c816a0f34b6213d
Author: Nicolas Malin <ni...@nereide.fr>
AuthorDate: Fri Jun 17 10:02:02 2022 +0200

    Fixed: Backport ProductWorker getBoolean logic update (OFBIZ-12609) (OFBIZ-12649)
    
    If chargeShipping is null (default) the method ProductWorker.shippingApplies
    fails.
    GenericEntity::getBoolean has changed. If the passed value equals null, false is
    returned. ProductWorker expects "null".
    
    jleroux: GenericEntity::getBoolean has been changed for OFBIZ-12386 "Fix some
    bugs SpotBugs reports". I checked at least that
    "CommunicationEventServices::sendEmailToContactList handles correctly
    tmpResult != null". After this fix I have to check other possible similar cases
    I neglected. Fortunately, only trunk is concerned.
    
    Thanks: Ingo Wolfmayr
---
 .../java/org/apache/ofbiz/product/product/ProductWorker.java | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java
index f0d74458c6..5c02857a37 100644
--- a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java
+++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java
@@ -67,17 +67,13 @@ public final class ProductWorker {
         String errMsg = "";
         if (product != null) {
             String productTypeId = product.getString("productTypeId");
-            if ("SERVICE".equals(productTypeId) || "SERVICE_PRODUCT".equals(productTypeId) || (ProductWorker.isDigital(product)
-                    && !ProductWorker.isPhysical(product))) {
+            if ("SERVICE".equals(productTypeId) || "SERVICE_PRODUCT".equals(productTypeId)
+                    || (ProductWorker.isDigital(product) && !ProductWorker.isPhysical(product))) {
                 // don't charge shipping on services or digital goods
                 return false;
             }
-            Boolean chargeShipping = product.getBoolean("chargeShipping");
-
-            if (chargeShipping == null) {
-                return true;
-            }
-            return chargeShipping;
+            return product.get("chargeShipping") == null
+                    || product.getBoolean("chargeShipping");
         }
         throw new IllegalArgumentException(errMsg);
     }