From 8e8272b4fa825dcfa146a66ac049662c8aabc40d Mon Sep 17 00:00:00 2001 From: Divesh Dutta Date: Sat, 5 Nov 2016 11:27:46 +0000 Subject: [PATCH] Improvement: Generic value is null or not should be checked using native checks. Utility method isEmpty or isNotEmpty is not needed to check if generic value is null or not because generic values can never be empty. They can be null or not nulls. So made changes accordingly all over the places. (OFBIZ-8471) Thanks: Ratnesh Upadhyay for reporting the improvement and providing the patch. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1768192 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/ofbiz/accounting/GlEvents.java | 4 +-- .../accounting/invoice/InvoiceWorker.java | 2 +- .../accounting/period/PeriodServices.java | 2 +- .../authorizedotnet/AIMPaymentServices.java | 4 +-- .../cybersource/IcsPaymentServices.java | 2 +- .../thirdparty/ideal/IdealEvents.java | 2 +- .../orbital/OrbitalPaymentServices.java | 4 +-- .../thirdparty/sagepay/SagePayServices.java | 2 +- .../apache/ofbiz/content/cms/CmsEvents.java | 2 +- .../apache/ofbiz/humanres/HumanResEvents.java | 2 +- .../jobshopmgt/ProductionRunServices.java | 6 ++-- .../org/apache/ofbiz/sfa/vcard/VCard.java | 6 ++-- .../ofbiz/order/order/OrderReadHelper.java | 2 +- .../order/order/OrderReturnServices.java | 28 +++++++++---------- .../ofbiz/order/order/OrderServices.java | 14 +++++----- .../requirement/RequirementServices.java | 2 +- .../order/shoppingcart/CheckOutEvents.java | 2 +- .../order/shoppingcart/ShoppingCart.java | 4 +-- .../shoppingcart/ShoppingCartHelper.java | 2 +- .../order/shoppingcart/ShoppingCartItem.java | 2 +- .../shoppingcart/ShoppingCartServices.java | 4 +-- .../product/ProductPromoWorker.java | 4 +-- .../shipping/ShippingEstimateWrapper.java | 2 +- .../shoppingcart/shipping/ShippingEvents.java | 4 +-- .../shoppinglist/ShoppingListEvents.java | 2 +- .../CommunicationEventServices.java | 10 +++---- .../party/PartyRelationshipServices.java | 2 +- .../ofbiz/party/party/PartyTypeHelper.java | 2 +- .../apache/ofbiz/party/party/PartyWorker.java | 4 +-- .../product/category/CatalogUrlFilter.java | 6 ++-- .../product/category/CatalogUrlServlet.java | 2 +- .../product/category/CategoryServices.java | 2 +- .../ofbiz/product/price/PriceServices.java | 4 +-- .../product/ProductContentWrapper.java | 2 +- .../product/ProductPromoContentWrapper.java | 8 +++--- .../product/product/ProductServices.java | 4 +-- .../ofbiz/product/product/ProductWorker.java | 16 +++++------ .../product/store/ProductStoreEvents.java | 2 +- .../shipment/shipment/ShipmentServices.java | 2 +- .../thirdparty/fedex/FedexServices.java | 2 +- .../shipment/thirdparty/ups/UpsServices.java | 4 +-- .../thirdparty/usps/UspsServices.java | 2 +- .../ofbiz/securityext/login/LoginEvents.java | 2 +- .../entity/util/EntityUtilProperties.java | 2 +- .../ofbiz/service/mail/JavaMailContainer.java | 4 +-- .../ofbiz/widget/portal/PortalPageWorker.java | 4 +-- .../cmssite/multisite/WebSiteFilter.java | 2 +- .../org/apache/ofbiz/ebay/EbayHelper.java | 8 +++--- .../apache/ofbiz/ebaystore/EbayEvents.java | 6 ++-- .../org/apache/ofbiz/ebaystore/EbayStore.java | 12 ++++---- .../ebaystore/EbayStoreAutoPreferences.java | 6 ++-- .../ofbiz/ebaystore/EbayStoreHelper.java | 4 +-- .../ofbiz/ebaystore/EbayStoreOrder.java | 10 +++---- .../ecommerce/janrain/JanrainHelper.java | 2 +- .../ofbiz/passport/event/LinkedInEvents.java | 2 +- .../passport/user/LinkedInAuthenticator.java | 4 +-- .../org/apache/ofbiz/scrum/ScrumServices.java | 2 +- .../org/apache/ofbiz/webpos/WebPosEvents.java | 10 +++---- 58 files changed, 132 insertions(+), 132 deletions(-) diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/GlEvents.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/GlEvents.java index 493c291a04..3580060ece 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/GlEvents.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/GlEvents.java @@ -66,7 +66,7 @@ public static String createReconcileAccount(HttpServletRequest request, HttpServ glAccountId = (String) ctx.get("glAccountId" + suffix); try { GenericValue acctgTransEntry = EntityQuery.use(delegator).from("AcctgTransEntry").where("acctgTransId", acctgTransId, "acctgTransEntrySeqId", acctgTransEntrySeqId).queryOne(); - if (UtilValidate.isNotEmpty(acctgTransEntry)) { + if (acctgTransEntry != null) { //calculate amount for each AcctgTransEntry according to glAccountId based on debit and credit debitCreditFlag = acctgTransEntry.getString("debitCreditFlag"); if ("D".equalsIgnoreCase(debitCreditFlag)) { @@ -104,7 +104,7 @@ public static String createReconcileAccount(HttpServletRequest request, HttpServ acctgTransEntrySeqId = (String) ctx.get("acctgTransEntrySeqId" + suffix); try { GenericValue acctgTransEntry = EntityQuery.use(delegator).from("AcctgTransEntry").where("acctgTransId", acctgTransId, "acctgTransEntrySeqId", acctgTransEntrySeqId).queryOne(); - if (UtilValidate.isNotEmpty(acctgTransEntry)) { + if (acctgTransEntry != null ) { reconciledAmount = acctgTransEntry.getString("amount"); acctgTransId = acctgTransEntry.getString("acctgTransId"); acctgTransEntrySeqId = acctgTransEntry.getString("acctgTransEntrySeqId"); diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java index b3f41217f7..a08d5f4e5e 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java @@ -593,7 +593,7 @@ public final class InvoiceWorker { BigDecimal taxGrandTotal = ZERO; List> taxByTaxAuthGeoAndPartyList = new LinkedList>(); List invoiceItems = null; - if (UtilValidate.isNotEmpty(invoice)) { + if (invoice != null) { try { invoiceItems = invoice.getRelated("InvoiceItem", null, null, false); } catch (GenericEntityException e) { diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/period/PeriodServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/period/PeriodServices.java index e964213c17..bc507d417a 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/period/PeriodServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/period/PeriodServices.java @@ -85,7 +85,7 @@ public class PeriodServices { findParams.put("periodTypeId", periodTypeId); } GenericValue timePeriod = EntityQuery.use(delegator).from("CustomTimePeriod").where(findParams).orderBy("fromDate ASC").queryFirst(); - if (UtilValidate.isNotEmpty(timePeriod) && UtilValidate.isNotEmpty(timePeriod.get("fromDate"))) { + if (timePeriod != null && UtilValidate.isNotEmpty(timePeriod.get("fromDate"))) { lastClosedDate = timePeriod.getTimestamp("fromDate"); } else { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingPeriodCannotGet", locale)); diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java index 9db0e4c16e..7bdd675fca 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java @@ -551,7 +551,7 @@ public class AIMPaymentServices { String orderId = UtilFormatOut.checkNull((String)params.get("orderId")); if (UtilValidate.isEmpty(orderId)) { GenericValue orderPaymentPreference = (GenericValue) params.get("orderPaymentPreference"); - if (UtilValidate.isNotEmpty(orderPaymentPreference)) { + if (orderPaymentPreference != null) { orderId = (String) orderPaymentPreference.get("orderId"); } } @@ -792,7 +792,7 @@ public class AIMPaymentServices { if (UtilValidate.isNotEmpty(paymentGatewayConfigId)) { try { GenericValue payflowPro = EntityQuery.use(delegator).from("PaymentGatewayAuthorizeNet").where("paymentGatewayConfigId", paymentGatewayConfigId).queryOne(); - if (UtilValidate.isNotEmpty(payflowPro)) { + if (payflowPro != null) { Object payflowProField = payflowPro.get(paymentGatewayConfigParameterName); if (payflowProField != null) { returnValue = payflowProField.toString().trim(); diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java index e7712d3fa3..a4a057ca25 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java @@ -672,7 +672,7 @@ public class IcsPaymentServices { if (UtilValidate.isNotEmpty(paymentGatewayConfigId)) { try { GenericValue cyberSource = EntityQuery.use(delegator).from("PaymentGatewayCyberSource").where("paymentGatewayConfigId", paymentGatewayConfigId).queryOne(); - if (UtilValidate.isNotEmpty(cyberSource)) { + if (cyberSource != null) { Object cyberSourceField = cyberSource.get(paymentGatewayConfigParameterName); if (cyberSourceField != null) { returnValue = cyberSourceField.toString().trim(); diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/ideal/IdealEvents.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/ideal/IdealEvents.java index b67b528c90..d9177434a7 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/ideal/IdealEvents.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/ideal/IdealEvents.java @@ -404,7 +404,7 @@ public class IdealEvents { if (UtilValidate.isNotEmpty(paymentGatewayConfigId)) { try { GenericValue ideal = EntityQuery.use(delegator).from("PaymentGatewayiDEAL").where("paymentGatewayConfigId", paymentGatewayConfigId).queryOne(); - if (UtilValidate.isNotEmpty(ideal)) { + if (ideal != null) { Object idealField = ideal.get(paymentGatewayConfigParameterName); if (idealField != null) { returnValue = idealField.toString().trim(); diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/orbital/OrbitalPaymentServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/orbital/OrbitalPaymentServices.java index b3470c3237..80e1d0bfb9 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/orbital/OrbitalPaymentServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/orbital/OrbitalPaymentServices.java @@ -290,9 +290,9 @@ public class OrbitalPaymentServices { if (UtilValidate.isNotEmpty(paymentGatewayConfigId)) { try { GenericValue paymentGatewayOrbital = EntityQuery.use(delegator).from("PaymentGatewayOrbital").where("paymentGatewayConfigId", paymentGatewayConfigId).queryOne(); - if (UtilValidate.isNotEmpty(paymentGatewayOrbital)) { + if (paymentGatewayOrbital != null) { Object paymentGatewayOrbitalField = paymentGatewayOrbital.get(paymentGatewayConfigParameterName); - if (UtilValidate.isNotEmpty(paymentGatewayOrbitalField)) { + if (paymentGatewayOrbitalField != null) { return returnValue = paymentGatewayOrbitalField.toString().trim(); } } diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayServices.java index 877100b83b..7953465b9b 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayServices.java @@ -57,7 +57,7 @@ public class SagePayServices if (UtilValidate.isNotEmpty(paymentGatewayConfigId)) { try { GenericValue sagePay = EntityQuery.use(delegator).from("PaymentGatewaySagePay").where("paymentGatewayConfigId", paymentGatewayConfigId).queryOne(); - if (UtilValidate.isNotEmpty(sagePay)) { + if (sagePay != null) { Map tmp = sagePay.getAllFields(); Set keys = tmp.keySet(); for (String key : keys) { diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/cms/CmsEvents.java b/applications/content/src/main/java/org/apache/ofbiz/content/cms/CmsEvents.java index c3d1174f07..7bde4f885a 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/cms/CmsEvents.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/cms/CmsEvents.java @@ -316,7 +316,7 @@ public class CmsEvents { String siteName = null; try { GenericValue content = EntityQuery.use(delegator).from("Content").where("contentId", contentId).cache().queryOne(); - if (content != null && UtilValidate.isNotEmpty(content)) { + if (content != null && UtilValidate.isNotEmpty(content.getString("contentName"))) { contentName = content.getString("contentName"); } else { request.setAttribute("_ERROR_MESSAGE_", "Content: " + contentName + " [" + contentId + "] is not a publish point for the current website: [" + webSiteId + "]"); diff --git a/applications/humanres/src/main/java/org/apache/ofbiz/humanres/HumanResEvents.java b/applications/humanres/src/main/java/org/apache/ofbiz/humanres/HumanResEvents.java index 9651bfa534..82f98c3378 100644 --- a/applications/humanres/src/main/java/org/apache/ofbiz/humanres/HumanResEvents.java +++ b/applications/humanres/src/main/java/org/apache/ofbiz/humanres/HumanResEvents.java @@ -66,7 +66,7 @@ public class HumanResEvents { try { GenericValue partyGroup = EntityQuery.use(delegator).from("PartyGroup").where("partyId", partyId).queryOne(); - if (UtilValidate.isNotEmpty(partyGroup)) { + if (partyGroup != null) { paramMap.put("partyGroup", partyGroup); /* get the child departments of company or party */ categoryList.addAll(getChildComps(paramMap)); diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java index d07a7a6a26..6420315317 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java @@ -1126,16 +1126,16 @@ public class ProductionRunServices { // Now get the cost information associated to the fixed asset and compute the costs GenericValue fixedAsset = workEffort.getRelatedOne("FixedAsset", false); - if (UtilValidate.isEmpty(fixedAsset) && UtilValidate.isNotEmpty(routingTask)) { + if (fixedAsset != null && routingTask != null) { fixedAsset = routingTask.getRelatedOne("FixedAsset", false); } - if (UtilValidate.isNotEmpty(fixedAsset)) { + if (fixedAsset != null) { List setupCosts = fixedAsset.getRelated("FixedAssetStdCost", UtilMisc.toMap("fixedAssetStdCostTypeId", "SETUP_COST"), null, false); GenericValue setupCost = EntityUtil.getFirst(EntityUtil.filterByDate(setupCosts)); List usageCosts = fixedAsset.getRelated("FixedAssetStdCost", UtilMisc.toMap("fixedAssetStdCostTypeId", "USAGE_COST"), null, false); GenericValue usageCost = EntityUtil.getFirst(EntityUtil.filterByDate(usageCosts)); - if (UtilValidate.isNotEmpty(setupCost) || UtilValidate.isNotEmpty(usageCost)) { + if (setupCost != null || usageCost != null) { String currencyUomId = (setupCost != null? setupCost.getString("amountUomId"): usageCost.getString("amountUomId")); BigDecimal setupCostAmount = ZERO; if (setupCost != null) { diff --git a/applications/marketing/src/main/java/org/apache/ofbiz/sfa/vcard/VCard.java b/applications/marketing/src/main/java/org/apache/ofbiz/sfa/vcard/VCard.java index b858046725..b1ab33065e 100644 --- a/applications/marketing/src/main/java/org/apache/ofbiz/sfa/vcard/VCard.java +++ b/applications/marketing/src/main/java/org/apache/ofbiz/sfa/vcard/VCard.java @@ -254,11 +254,11 @@ public class VCard { address.setLocality(postalAddress.getString("city")); address.setPostalCode(postalAddress.getString("postalCode")); GenericValue state = postalAddress.getRelatedOne("StateProvinceGeo", false); - if (UtilValidate.isNotEmpty(state)) { + if (state != null) { address.setRegion(state.getString("geoName")); } GenericValue countryGeo = postalAddress.getRelatedOne("CountryGeo", false); - if (UtilValidate.isNotEmpty(countryGeo)) { + if (countryGeo != null) { String country = postalAddress.getRelatedOne("CountryGeo", false).getString("geoName"); address.setCountry(country); address.getTypes().add(AddressType.WORK);; @@ -268,7 +268,7 @@ public class VCard { } GenericValue telecomNumber = PartyWorker.findPartyLatestTelecomNumber(partyId, delegator); - if (UtilValidate.isNotEmpty(telecomNumber)) { + if (telecomNumber != null) { Telephone tel = new Telephone(telecomNumber.getString("areaCode") + telecomNumber.getString("contactNumber")); tel.getTypes().add(TelephoneType.WORK); vcard.addTelephoneNumber(tel); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReadHelper.java b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReadHelper.java index 6ae591fa11..e0ad51d26f 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReadHelper.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReadHelper.java @@ -2998,7 +2998,7 @@ public class OrderReadHelper { public BigDecimal getItemReceivedQuantity(GenericValue orderItem) { BigDecimal totalReceived = BigDecimal.ZERO; try { - if (UtilValidate.isNotEmpty(orderItem)) { + if (orderItem != null) { EntityCondition cond = EntityCondition.makeCondition(UtilMisc.toList( EntityCondition.makeCondition("orderId", orderItem.getString("orderId")), EntityCondition.makeCondition("quantityAccepted", EntityOperator.GREATER_THAN, BigDecimal.ZERO), diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java index ec5130aba5..29c8f36394 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java @@ -162,7 +162,7 @@ public class OrderReturnServices { Debug.logError(e, module); throw new GeneralRuntimeException(e.getMessage()); } - if (UtilValidate.isNotEmpty(issue)) { + if (issue != null) { Debug.logInfo("Found item issuance reference", module); // just use the first one for now; maybe later we can find a better way to determine which was the // actual item being returned; maybe by serial number @@ -736,7 +736,7 @@ public class OrderReturnServices { if (UtilValidate.isNotEmpty(returnItems)) { returnItem = EntityUtil.getFirst(returnItems); } - if (UtilValidate.isNotEmpty(returnItem)) { + if (returnItem != null) { try { orderHeader = returnItem.getRelatedOne("OrderHeader", false); } catch (GenericEntityException e) { @@ -822,7 +822,7 @@ public class OrderReturnServices { } catch (GenericEntityException e) { return ServiceUtil.returnError(e.getMessage()); } - if (UtilValidate.isNotEmpty(finAccount)) { + if (finAccount != null) { finAccountId = finAccount.getString("finAccountId"); } @@ -1201,7 +1201,7 @@ public class OrderReturnServices { GenericValue orderItemAssoc = EntityQuery.use(delegator).from("OrderItemAssoc") .where("toOrderId", orderId, "orderItemAssocTypeId", "REPLACEMENT") .queryFirst(); - if (UtilValidate.isNotEmpty(orderItemAssoc)) { + if (orderItemAssoc != null) { String originalOrderId = orderItemAssoc.getString("orderId"); orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", originalOrderId).queryOne(); orderPayPrefs = orderHeader.getRelated("OrderPaymentPreference", null, UtilMisc.toList("-maxAmount"), false); @@ -1231,7 +1231,7 @@ public class OrderReturnServices { } orgAcctgPref = (GenericValue) acctgPreferencesResult.get("partyAccountingPreference"); - if (UtilValidate.isNotEmpty(orgAcctgPref)) { + if (orgAcctgPref != null) { try { orgAcctgPref.getRelatedOne("PaymentMethod", false); } catch (GenericEntityException e) { @@ -1420,7 +1420,7 @@ public class OrderReturnServices { // Fill out the data for the new ReturnItemResponse Map response = new HashMap(); - if (UtilValidate.isNotEmpty(refundOrderPaymentPreference)) { + if (refundOrderPaymentPreference != null) { response.put("orderPaymentPreferenceId", refundOrderPaymentPreference.getString("orderPaymentPreferenceId")); } else { response.put("orderPaymentPreferenceId", orderPaymentPreference.getString("orderPaymentPreferenceId")); @@ -1781,16 +1781,16 @@ public class OrderReturnServices { GenericValue refurbItem = null; if ("CUSTOMER_RETURN".equals(returnHeaderTypeId)) { try { - if (UtilValidate.isNotEmpty(product)) { + if (product != null) { GenericValue refurbItemAssoc = EntityUtil.getFirst(EntityUtil.filterByDate(product.getRelated("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_REFURB"), UtilMisc.toList("sequenceNum"), false))); - if (UtilValidate.isNotEmpty(refurbItemAssoc)) { + if (refurbItemAssoc != null) { refurbItem = refurbItemAssoc.getRelatedOne("AssocProduct", false); } } } catch (GenericEntityException e) { Debug.logError(e, module); } - if (UtilValidate.isNotEmpty(refurbItem)) { + if (refurbItem != null) { boolean inventoryAvailable = false; try { Map invReqResult = dispatcher.runSync("isStoreInventoryAvailable", UtilMisc.toMap("productStoreId", orderHeader.get("productStoreId"), @@ -1864,7 +1864,7 @@ public class OrderReturnServices { if ("RTN_REPAIR_REPLACE".equals(returnTypeId)) { List repairItems = null; try { - if (UtilValidate.isNotEmpty(product)) { + if (product != null) { repairItems = EntityUtil.filterByDate(product.getRelated("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_REPAIR_SRV"), UtilMisc.toList("sequenceNum"), false)); } } catch (GenericEntityException e) { @@ -1880,7 +1880,7 @@ public class OrderReturnServices { Debug.logError(e, module); continue; } - if (UtilValidate.isNotEmpty(repairItemProduct)) { + if (repairItemProduct != null) { BigDecimal repairUnitQuantity = repairItem.getBigDecimal("quantity"); if (UtilValidate.isEmpty(repairUnitQuantity)) { repairUnitQuantity = BigDecimal.ONE; @@ -1937,7 +1937,7 @@ public class OrderReturnServices { newItem.set("statusId", "ITEM_CREATED"); orderItems.add(newItem); additionalItemTotal = additionalItemTotal.add(repairQuantity.multiply(repairUnitPrice)); - if (UtilValidate.isNotEmpty(orderItemShipGroupAssoc)) { + if (orderItemShipGroupAssoc != null) { GenericValue newOrderItemShipGroupAssoc = delegator.makeValue("OrderItemShipGroupAssoc", UtilMisc.toMap("orderItemSeqId", newItem.getString("orderItemSeqId"), "shipGroupSeqId", orderItemShipGroupAssoc.getString("shipGroupSeqId"), "quantity", repairQuantity)); orderItemShipGroupInfo.add(newOrderItemShipGroupAssoc); } @@ -1982,7 +1982,7 @@ public class OrderReturnServices { } catch (GenericEntityException e) { Debug.logError(e, module); } - if (UtilValidate.isNotEmpty(paymentMethod)) { + if (paymentMethod != null) { String paymentMethodId = paymentMethod.getString("paymentMethodId"); String paymentMethodTypeId = paymentMethod.getString("paymentMethodTypeId"); GenericValue opp = delegator.makeValue("OrderPaymentPreference"); @@ -2381,7 +2381,7 @@ public class OrderReturnServices { returnItem = EntityQuery.use(delegator).from("ReturnItem") .where("returnId", returnId, "orderId", orderAdjustment.getString("orderId"), "orderItemSeqId", orderAdjustment.getString("orderItemSeqId")) .queryFirst(); - if (UtilValidate.isNotEmpty(returnItem)) { + if (returnItem != null) { orderItem = returnItem.getRelatedOne("OrderItem", false); } } diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java index 9bc4212c3b..d2e1519b33 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java @@ -123,7 +123,7 @@ public class OrderServices { if (UtilValidate.isEmpty(orderParty)) { orderParty = orh.getPlacingParty(); } - if (UtilValidate.isNotEmpty(orderParty)) { + if (orderParty != null) { partyId = orderParty.getString("partyId"); } boolean hasPermission = hasPermission(orderTypeId, partyId, userLogin, action, security); @@ -4348,7 +4348,7 @@ public class OrderServices { Debug.logError(e, module); throw new GeneralException(e.getMessage()); } - if (UtilValidate.isNotEmpty(oldOrderItem)) { + if (oldOrderItem != null) { // Existing order item found. Check for modifications and store if any String oldItemDescription = oldOrderItem.getString("itemDescription") != null ? oldOrderItem.getString("itemDescription") : ""; @@ -5796,14 +5796,14 @@ public class OrderServices { String orderId= (String) context.get("orderId"); GenericValue orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); String shipGroupSeqId= (String) context.get("shipGroupSeqId"); - if (UtilValidate.isNotEmpty(orderHeader) && UtilValidate.isNotEmpty(shipGroupSeqId)) { + if (orderHeader != null && UtilValidate.isNotEmpty(shipGroupSeqId)) { orderItemShipGroup = EntityQuery.use(delegator).from("OrderItemShipGroup").where("orderId", orderId, "shipGroupSeqId", shipGroupSeqId).queryOne(); if (UtilValidate.isEmpty(orderItemShipGroup)) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "OrderItemShipGroupDoesNotExist", locale)); } } } - if (UtilValidate.isNotEmpty(orderItemShipGroup)) { + if (orderItemShipGroup != null) { orderItemShipGroup.remove(); result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS); } @@ -5848,7 +5848,7 @@ public class OrderServices { if (UtilValidate.isNotEmpty(oisgas)) { GenericValue oisga = EntityUtil.getFirst(oisgas); GenericValue oisg = oisga.getRelatedOne("OrderItemShipGroup", false); - if (UtilValidate.isNotEmpty(oisg)) { + if (oisg != null) { addOrderItemShipGroupMap.put("shipmentMethodTypeId", oisg.get("shipmentMethodTypeId")); addOrderItemShipGroupMap.put("carrierPartyId", oisg.get("carrierPartyId")); addOrderItemShipGroupMap.put("carrierRoleTypeId", oisg.get("carrierRoleTypeId")); @@ -5879,7 +5879,7 @@ public class OrderServices { } //test if this association already exist if yes display error GenericValue oisgAssoc = EntityQuery.use(delegator).from("OrderItemShipGroupAssoc").where("orderId", orderId, "orderItemSeqId", orderItem.get("orderItemSeqId"), "shipGroupSeqId", shipGroupSeqId).queryOne(); - if (UtilValidate.isNotEmpty(oisgAssoc)) { + if (oisgAssoc != null) { String errMsg = mainErrorMessage + UtilProperties.getMessage(resource_error, "OrderErrorOrderItemAlreadyRelatedToShipGroup", locale); return ServiceUtil.returnError(errMsg); } @@ -6020,7 +6020,7 @@ public class OrderServices { oisga.store(); // reserve the inventory GenericValue orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); - if (UtilValidate.isNotEmpty(orderHeader)) { + if (orderHeader != null) { Map cancelResp = dispatcher.runSync("cancelOrderInventoryReservation", UtilMisc.toMap("userLogin", userLogin, "orderId", orderId, "orderItemSeqId", orderItemSeqId, "shipGroupSeqId", shipGroupSeqId )); if (ServiceUtil.isError(cancelResp)) { throw new GeneralException(ServiceUtil.getErrorMessage(cancelResp)); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/requirement/RequirementServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/requirement/RequirementServices.java index 3d7a6b904c..10ebdf1a40 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/requirement/RequirementServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/requirement/RequirementServices.java @@ -340,7 +340,7 @@ public class RequirementServices { GenericValue orderRequirementCommitment = EntityQuery.use(delegator).from("OrderRequirementCommitment") .where(UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItem.getString("orderItemSeqId"))) .queryFirst(); - if (UtilValidate.isNotEmpty(orderRequirementCommitment)) { + if (orderRequirementCommitment != null) { String requirementId = orderRequirementCommitment.getString("requirementId"); /* Change status of requirement to ordered */ Map inputMap = UtilMisc.toMap("userLogin", userLogin, "requirementId", requirementId, "statusId", "REQ_ORDERED", "quantity", orderItem.getBigDecimal("quantity")); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java index e29dce215f..4537330cbf 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/CheckOutEvents.java @@ -1151,7 +1151,7 @@ public class CheckOutEvents { .where("orderId", originalOrderId, "isPromo", sci.getIsPromo() ? "Y" : "N", "productId", sci.getProductId(), "orderItemTypeId", sci.getItemType()) .queryFirst(); - if (UtilValidate.isNotEmpty(orderItem)) { + if (orderItem != null) { sci.setAssociatedOrderId(orderItem.getString("orderId")); sci.setAssociatedOrderItemSeqId(orderItem.getString("orderItemSeqId")); sci.setOrderItemAssocTypeId("REPLACEMENT"); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java index 6bd59e7aff..23327a9876 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java @@ -2252,7 +2252,7 @@ public class ShoppingCart implements Iterable, Serializable { if (UtilValidate.isNotEmpty(shipItems)) { for (ShoppingCartItem cartItem : shipItems) { GenericValue product = cartItem.getProduct(); - if (UtilValidate.isNotEmpty(product)) { + if (product != null) { if (!ProductWorker.isShippableToAddress(product, shippingAddress)) { throw new IllegalArgumentException("The shipping address is not compatible with ProductGeos rules."); } @@ -4675,7 +4675,7 @@ public class ShoppingCart implements Iterable, Serializable { } if (shippingAddress != null) { GenericValue product = item.getProduct(); - if (UtilValidate.isNotEmpty(product)) { + if (product != null) { return ProductWorker.isShippableToAddress(product, shippingAddress); } } diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java index bbf9fecf3c..75ea1c7dc9 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartHelper.java @@ -218,7 +218,7 @@ public class ShoppingCartHelper { } catch (GenericEntityException gee) { Debug.logError(gee, module); } - if (UtilValidate.isNotEmpty(productFeatureAndAppl)) { + if (productFeatureAndAppl != null) { productFeatureAndAppl.set("productFeatureApplTypeId", "STANDARD_FEATURE"); } additionalFeaturesMap.put(selectedFeatureType, productFeatureAndAppl); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java index 9548d1cad8..d426bb6360 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartItem.java @@ -1177,7 +1177,7 @@ public class ShoppingCartItem implements java.io.Serializable { this.setBasePrice(configWrapper.getTotalPrice()); // Check if price display with taxes GenericValue productStore = ProductStoreWorker.getProductStore(cart.getProductStoreId(), delegator); - if (UtilValidate.isNotEmpty(productStore) && "Y".equals(productStore.get("showPricesWithVatTax"))) { + if (productStore != null && "Y".equals(productStore.get("showPricesWithVatTax"))) { BigDecimal totalPrice = configWrapper.getTotalPrice(); // Get Taxes Map totalPriceWithTaxMap = dispatcher.runSync("calcTaxForDisplay", UtilMisc.toMap("basePrice", totalPrice, "productId", this.productId, "productStoreId", cart.getProductStoreId())); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java index e98b31d0b5..3b1a89c334 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartServices.java @@ -448,7 +448,7 @@ public class ShoppingCartServices { .where("productAssocTypeId", "PRODUCT_CONF", "productIdTo", product.getString("productId")) .filterByDate() .queryFirst(); - if (UtilValidate.isNotEmpty(productAssoc)) { + if (productAssoc != null) { productId = productAssoc.getString("productId"); configId = product.getString("configId"); } @@ -1170,7 +1170,7 @@ public class ShoppingCartServices { cart.positionItemToGroup(item, item.getQuantity(), 0, index, true); } } - if (UtilValidate.isNotEmpty(vendorProduct)) { + if (vendorProduct != null) { String vendorPartyId = vendorProduct.getString("vendorPartyId"); if (vendorMap.containsKey(vendorPartyId)) { index = ((Integer) vendorMap.get(vendorPartyId)).intValue(); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java index 83d132952d..53f3439c9b 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java @@ -689,7 +689,7 @@ public final class ProductPromoWorker { if ("PPIP_PARTY_CLASS".equalsIgnoreCase(productPromoCond.getString("inputParamEnumId"))) { GenericValue partyClassificationGroup = EntityQuery.use(delegator).from("PartyClassificationGroup").where("partyClassificationGroupId", condValue).cache(true).queryOne(); - if (UtilValidate.isNotEmpty(partyClassificationGroup) && UtilValidate.isNotEmpty(partyClassificationGroup.getString("description"))) { + if (partyClassificationGroup != null && UtilValidate.isNotEmpty(partyClassificationGroup.getString("description"))) { condValue = partyClassificationGroup.getString("description"); } @@ -1106,7 +1106,7 @@ public final class ProductPromoWorker { } else if ("PPIP_GEO_ID".equals(inputParamEnumId)) { compareBase = Integer.valueOf(1); GenericValue shippingAddress = cart.getShippingAddress(); - if (UtilValidate.isNotEmpty(condValue) && UtilValidate.isNotEmpty(shippingAddress)) { + if (UtilValidate.isNotEmpty(condValue) && shippingAddress != null) { if(condValue.equals(shippingAddress.getString("countryGeoId")) || condValue.equals(shippingAddress.getString("countyGeoId")) || condValue.equals(shippingAddress.getString("postalCodeGeoId")) || condValue.equals(shippingAddress.getString("stateProvinceGeoId"))) { compareBase = Integer.valueOf(0); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java index bf44612e13..91376655bd 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java @@ -80,7 +80,7 @@ public class ShippingEstimateWrapper { try { for (ShoppingCartItem item : cart.getShipGroupItems(shipGroup).keySet()) { GenericValue allowanceProductPrice = EntityQuery.use(delegator).from("ProductPrice").where("productPriceTypeId", "SHIPPING_ALLOWANCE", "productId", item.getProductId()).filterByDate().queryFirst(); - if (UtilValidate.isNotEmpty(allowanceProductPrice) && UtilValidate.isNotEmpty(allowanceProductPrice.get("price"))) { + if (allowanceProductPrice != null && UtilValidate.isNotEmpty(allowanceProductPrice.get("price"))) { totalAllowance = totalAllowance.add(allowanceProductPrice.getBigDecimal("price")).multiply(item.getQuantity()); } } diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEvents.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEvents.java index 375df9017b..1ea1ccb5d7 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEvents.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEvents.java @@ -124,7 +124,7 @@ public class ShippingEvents { String contactMechId = shipAddr.getString("contactMechId"); String partyId = null; GenericValue partyObject = orh.getPlacingParty(); - if (UtilValidate.isNotEmpty(partyObject)) { + if (partyObject != null) { partyId = partyObject.getString("partyId"); } return getShipGroupEstimate(dispatcher, delegator, orh.getOrderTypeId(), shipmentMethodTypeId, carrierPartyId, carrierRoleTypeId, @@ -298,7 +298,7 @@ public class ShippingEvents { GenericValue customMethod = null; try { customMethod = EntityQuery.use(delegator).from("CustomMethod").where("customMethodId", shipmentCustomMethodId).queryOne(); - if (UtilValidate.isNotEmpty(customMethod)) { + if (customMethod != null) { serviceName = customMethod.getString("customMethodName"); } } catch (GenericEntityException e) { diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java index 12b8d1428e..dde5c538f6 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java @@ -632,7 +632,7 @@ public class ShoppingListEvents { Cookie[] cookies = request.getCookies(); // check userLogin - if (UtilValidate.isNotEmpty(userLogin)) { + if (userLogin != null) { String partyId = userLogin.getString("partyId"); if (UtilValidate.isEmpty(partyId)) { return "success"; diff --git a/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java b/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java index 1bde2c7422..41d2fa6c3a 100644 --- a/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java +++ b/applications/party/src/main/java/org/apache/ofbiz/party/communication/CommunicationEventServices.java @@ -170,7 +170,7 @@ public class CommunicationEventServices { continue; } GenericValue contactMech = commRole.getRelatedOne("ContactMech", false); - if (UtilValidate.isNotEmpty(contactMech) && UtilValidate.isNotEmpty(contactMech.getString("infoString"))) { + if (contactMech != null && UtilValidate.isNotEmpty(contactMech.getString("infoString"))) { if ("ADDRESSEE".equals(commRole.getString("roleTypeId"))) { sendTo += "," + contactMech.getString("infoString"); } else if ("CC".equals(commRole.getString("roleTypeId"))) { @@ -377,7 +377,7 @@ public class CommunicationEventServices { GenericValue contactListPartyStatus = EntityQuery.use(delegator).from("ContactListPartyStatus") .where("contactListId", contactListId, "partyId", contactListPartyAndContactMech.getString("partyId"), "fromDate", contactListPartyAndContactMech.getTimestamp("fromDate"), "statusId", "CLPT_ACCEPTED") .queryFirst(); - if (UtilValidate.isNotEmpty(contactListPartyStatus)) { + if (contactListPartyStatus != null) { // prepare body parameters Map bodyParameters = new HashMap(); bodyParameters.put("contactListId", contactListId); @@ -390,12 +390,12 @@ public class CommunicationEventServices { NotificationServices.setBaseUrl(delegator, contactList.getString("verifyEmailWebSiteId"), bodyParameters); GenericValue webSite = EntityQuery.use(delegator).from("WebSite").where("webSiteId", contactList.getString("verifyEmailWebSiteId")).queryOne(); - if (UtilValidate.isNotEmpty(webSite)) { + if (webSite != null) { GenericValue productStore = webSite.getRelatedOne("ProductStore", false); - if (UtilValidate.isNotEmpty(productStore)) { + if (productStore != null) { List productStoreEmailSettings = productStore.getRelated("ProductStoreEmailSetting", UtilMisc.toMap("emailType", "CONT_EMAIL_TEMPLATE"), null, false); GenericValue productStoreEmailSetting = EntityUtil.getFirst(productStoreEmailSettings); - if (UtilValidate.isNotEmpty(productStoreEmailSetting)) { + if (productStoreEmailSetting != null) { // send e-mail using screen template sendMailParams.put("bodyScreenUri", productStoreEmailSetting.getString("bodyScreenLocation")); sendMailParams.put("bodyParameters", bodyParameters); diff --git a/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyRelationshipServices.java b/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyRelationshipServices.java index ca50af55cc..c76aab3f48 100644 --- a/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyRelationshipServices.java +++ b/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyRelationshipServices.java @@ -145,7 +145,7 @@ public class PartyRelationshipServices { .where(sideChecked, partyId, "roleTypeIdFrom", roleTypeIdFrom, "roleTypeIdTo", roleTypeIdTo, "partyRelationshipTypeId", partyRelationshipTypeId) .filterByDate() .queryFirst(); - if (UtilValidate.isNotEmpty(oldPartyRelationShip)) { + if (oldPartyRelationShip != null) { oldPartyRelationShip.setFields(UtilMisc.toMap("thruDate", UtilDateTime.nowTimestamp())); // Current becomes inactive oldPartyRelationShip.store(); } diff --git a/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyTypeHelper.java b/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyTypeHelper.java index 1bed17e724..2fabaf829d 100644 --- a/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyTypeHelper.java +++ b/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyTypeHelper.java @@ -48,7 +48,7 @@ public final class PartyTypeHelper { GenericValue checkedTypeOfParty = null; try { party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne(); - if (UtilValidate.isNotEmpty(party)) { + if (party != null) { partyType = party.getRelatedOne("PartyType", true); checkedTypeOfParty = EntityQuery.use(delegator).from("PartyType").where("partyTypeId", checkedPartyType).cache().queryOne(); } else { diff --git a/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyWorker.java b/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyWorker.java index eef434cbac..07beeac7bd 100644 --- a/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyWorker.java +++ b/applications/party/src/main/java/org/apache/ofbiz/party/party/PartyWorker.java @@ -508,7 +508,7 @@ public class PartyWorker { party = EntityQuery.use(delegator).from("Party").where("partyId", idToFind).cache().queryOne(); } - if (UtilValidate.isNotEmpty(party)) { + if (party != null) { if (UtilValidate.isNotEmpty(partiesFound)) partiesFound.add(party); else partiesFound = UtilMisc.toList(party); } @@ -523,7 +523,7 @@ public class PartyWorker { public static String findPartyId(Delegator delegator, String idToFind, String partyIdentificationTypeId) throws GenericEntityException { GenericValue party = findParty(delegator, idToFind, partyIdentificationTypeId); - if (UtilValidate.isNotEmpty(party)) { + if (party != null) { return party.getString("partyId"); } else { return null; diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlFilter.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlFilter.java index b11f32a9eb..2b31f95910 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlFilter.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlFilter.java @@ -98,7 +98,7 @@ public class CatalogUrlFilter implements Filter { if (UtilValidate.isNotEmpty(ContentAssocDataResourceViewTos)) { for (GenericValue ContentAssocDataResourceViewTo : ContentAssocDataResourceViewTos) { GenericValue ElectronicText = ContentAssocDataResourceViewTo.getRelatedOne("ElectronicText", true); - if (UtilValidate.isNotEmpty(ElectronicText)) { + if (ElectronicText != null) { String textData = (String) ElectronicText.get("textData"); textData = UrlServletHelper.invalidCharacter(textData); if (alternativeUrl.matches(textData + ".+$")) { @@ -153,7 +153,7 @@ public class CatalogUrlFilter implements Filter { if (UtilValidate.isNotEmpty(ContentAssocDataResourceViewTos)) { for (GenericValue ContentAssocDataResourceViewTo : ContentAssocDataResourceViewTos) { GenericValue ElectronicText = ContentAssocDataResourceViewTo.getRelatedOne("ElectronicText", true); - if (UtilValidate.isNotEmpty(ElectronicText)) { + if (ElectronicText != null) { String textData = (String) ElectronicText.get("textData"); if (UtilValidate.isNotEmpty(textData)) { textData = UrlServletHelper.invalidCharacter(textData); @@ -175,7 +175,7 @@ public class CatalogUrlFilter implements Filter { List contentDataResourceViews = EntityQuery.use(delegator).from("ContentDataResourceView").where("contentId", contentId, "drDataResourceTypeId", "ELECTRONIC_TEXT").cache(true).queryList(); for (GenericValue contentDataResourceView : contentDataResourceViews) { GenericValue ElectronicText = contentDataResourceView.getRelatedOne("ElectronicText", true); - if (UtilValidate.isNotEmpty(ElectronicText)) { + if (ElectronicText != null) { String textData = (String) ElectronicText.get("textData"); if (UtilValidate.isNotEmpty(textData)) { textData = UrlServletHelper.invalidCharacter(textData); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlServlet.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlServlet.java index 7c22bdf1a9..985a631da8 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlServlet.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlServlet.java @@ -93,7 +93,7 @@ public class CatalogUrlServlet extends HttpServlet { productId = lastPathElement.substring(2); } else { GenericValue productCategory = EntityQuery.use(delegator).from("ProductCategory").where("productCategoryId", lastPathElement).cache(true).queryOne(); - if (UtilValidate.isNotEmpty(productCategory)) { + if (productCategory != null) { categoryId = lastPathElement; } else { productId = lastPathElement; diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java index fbb8273235..fd10655c42 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java @@ -466,7 +466,7 @@ public class CategoryServices { try { GenericValue category = EntityQuery.use(delegator).from(entityName).where(primaryKeyName, productCategoryId).queryOne(); - if (UtilValidate.isNotEmpty(category)) { + if (category != null) { if (isCatalog.equals("true") && isCategoryType.equals("false")) { CategoryWorker.getRelatedCategories(request, "ChildCatalogList", CatalogWorker.getCatalogTopCategoryId(request, productCategoryId), true); childOfCats = EntityUtil.filterByDate((List) request.getAttribute("ChildCatalogList")); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java index 3b6b58e776..f6bd34a4d2 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java @@ -142,7 +142,7 @@ public class PriceServices { String currencyDefaultUomId = (String) context.get("currencyUomId"); String currencyUomIdTo = (String) context.get("currencyUomIdTo"); if (UtilValidate.isEmpty(currencyDefaultUomId)) { - if (UtilValidate.isNotEmpty(productStore) && UtilValidate.isNotEmpty(productStore.getString("defaultCurrencyUomId"))) { + if (productStore != null && UtilValidate.isNotEmpty(productStore.getString("defaultCurrencyUomId"))) { currencyDefaultUomId = productStore.getString("defaultCurrencyUomId"); } else { currencyDefaultUomId = EntityUtilProperties.getPropertyValue("general", "currency.uom.id.default", "USD", delegator); @@ -344,7 +344,7 @@ public class PriceServices { } catch (GenericEntityException gee) { Debug.logError(gee, "An error occurred while getting the customPriceCalcService", module); } - if (UtilValidate.isNotEmpty(customMethod) && UtilValidate.isNotEmpty(customMethod.getString("customMethodName"))) { + if (customMethod != null && UtilValidate.isNotEmpty(customMethod.getString("customMethodName"))) { Map inMap = UtilMisc.toMap("userLogin", context.get("userLogin"), "product", product); inMap.put("initialPrice", defaultPriceValue.getBigDecimal("price")); inMap.put("currencyUomId", currencyDefaultUomId); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductContentWrapper.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductContentWrapper.java index 1dfde60102..b8990a94b7 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductContentWrapper.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductContentWrapper.java @@ -163,7 +163,7 @@ public class ProductContentWrapper implements ContentWrapper { List productContentList = EntityQuery.use(delegator).from("ProductContent").where("productId", productId, "productContentTypeId", productContentTypeId).orderBy("-fromDate").cache(cache).filterByDate().queryList(); if (UtilValidate.isEmpty(productContentList) && ("Y".equals(product.getString("isVariant")))) { GenericValue parent = ProductWorker.getParentProduct(productId, delegator); - if (UtilValidate.isNotEmpty(parent)) { + if (parent != null) { productContentList = EntityQuery.use(delegator).from("ProductContent").where("productId", parent.get("productId"), "productContentTypeId", productContentTypeId).orderBy("-fromDate").cache(cache).filterByDate().queryList(); } } diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductPromoContentWrapper.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductPromoContentWrapper.java index c9095af6a6..e273b85b02 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductPromoContentWrapper.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductPromoContentWrapper.java @@ -149,11 +149,11 @@ public class ProductPromoContentWrapper implements ContentWrapper { } public static void getProductPromoContentAsText(String productPromoId, GenericValue productPromo, String productPromoContentTypeId, Locale locale, String mimeTypeId, String partyId, String roleTypeId, Delegator delegator, LocalDispatcher dispatcher, Writer outWriter, boolean cache) throws GeneralException, IOException { - if (UtilValidate.isEmpty(productPromoId) && UtilValidate.isNotEmpty(productPromo)) { + if (UtilValidate.isEmpty(productPromoId) && productPromo != null) { productPromoId = productPromo.getString("productPromoId"); } - if (UtilValidate.isEmpty(delegator) && UtilValidate.isNotEmpty(productPromo)) { + if (UtilValidate.isEmpty(delegator) && productPromo != null) { delegator = productPromo.getDelegator(); } @@ -175,7 +175,7 @@ public class ProductPromoContentWrapper implements ContentWrapper { productPromoContent = EntityUtil.getFirst(EntityUtil.filterByDate(productPromoContentList)); } - if (UtilValidate.isNotEmpty(productPromoContent)) { + if (productPromoContent != null) { // when rendering the product promo content, always include the ProductPromo and ProductPromoContent records that this comes from Map inContext = new HashMap(); inContext.put("productPromo", productPromo); @@ -190,7 +190,7 @@ public class ProductPromoContentWrapper implements ContentWrapper { if (UtilValidate.isEmpty(productPromo)) { productPromo = EntityQuery.use(delegator).from("ProductPromo").where("productPromoId", productPromoId).cache().queryOne(); } - if (UtilValidate.isNotEmpty(productPromo)) { + if (productPromo != null) { String candidateValue = productPromo.getString(candidateFieldName); if (UtilValidate.isNotEmpty(candidateValue)) { outWriter.write(candidateValue); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java index 0ef10f6eca..b3fac39635 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java @@ -1323,7 +1323,7 @@ public class ProductServices { return ServiceUtil.returnError(e.getMessage()); } - if (UtilValidate.isNotEmpty(content)) { + if (content != null) { GenericValue dataResource = null; try { dataResource = content.getRelatedOne("DataResource", false); @@ -1332,7 +1332,7 @@ public class ProductServices { return ServiceUtil.returnError(e.getMessage()); } - if (UtilValidate.isNotEmpty(dataResource)) { + if (dataResource != null) { dataResourceCtx.put("dataResourceId", dataResource.getString("dataResourceId")); try { dispatcher.runSync("updateDataResource", dataResourceCtx); 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 07c65e06d6..b48ebeb537 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 @@ -89,7 +89,7 @@ public final class ProductWorker { return isAllowedToAddress(product, postalAddress, "PG_SHIP_"); } private static boolean isAllowedToAddress(GenericValue product, GenericValue postalAddress, String productGeoPrefix) { - if (UtilValidate.isNotEmpty(product) && UtilValidate.isNotEmpty(postalAddress)) { + if (product != null && postalAddress != null) { Delegator delegator = product.getDelegator(); List productGeos = null; try { @@ -134,7 +134,7 @@ public final class ProductWorker { public static boolean isSerialized (Delegator delegator, String productId) { try { GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).cache().queryOne(); - if (UtilValidate.isNotEmpty(product)) { + if (product != null) { return "SERIALIZED_INV_ITEM".equals(product.getString("inventoryItemTypeId")); } } catch (GenericEntityException e) { @@ -161,9 +161,9 @@ public final class ProductWorker { public static String getInstanceAggregatedId(Delegator delegator, String instanceProductId) throws GenericEntityException { GenericValue instanceProduct = EntityQuery.use(delegator).from("Product").where("productId", instanceProductId).queryOne(); - if (UtilValidate.isNotEmpty(instanceProduct) && EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", instanceProduct.getString("productTypeId"), "parentTypeId", "AGGREGATED")) { + if (instanceProduct != null && EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", instanceProduct.getString("productTypeId"), "parentTypeId", "AGGREGATED")) { GenericValue productAssoc = EntityUtil.getFirst(EntityUtil.filterByDate(instanceProduct.getRelated("AssocProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_CONF"), null, false))); - if (UtilValidate.isNotEmpty(productAssoc)) { + if (productAssoc != null) { return productAssoc.getString("productId"); } } @@ -186,7 +186,7 @@ public final class ProductWorker { public static List getAggregatedAssocs(Delegator delegator, String aggregatedProductId) throws GenericEntityException { GenericValue aggregatedProduct = EntityQuery.use(delegator).from("Product").where("productId", aggregatedProductId).queryOne(); - if (UtilValidate.isNotEmpty(aggregatedProduct) && ("AGGREGATED".equals(aggregatedProduct.getString("productTypeId")) || "AGGREGATED_SERVICE".equals(aggregatedProduct.getString("productTypeId")))) { + if (aggregatedProduct != null && ("AGGREGATED".equals(aggregatedProduct.getString("productTypeId")) || "AGGREGATED_SERVICE".equals(aggregatedProduct.getString("productTypeId")))) { List productAssocs = EntityUtil.filterByDate(aggregatedProduct.getRelated("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_CONF"), null, false)); return productAssocs; } @@ -894,7 +894,7 @@ public final class ProductWorker { product = EntityQuery.use(delegator).from("Product").where("productId", idToFind).cache().queryOne(); } - if (UtilValidate.isNotEmpty(product)) { + if (product != null) { if (UtilValidate.isNotEmpty(productsFound)) productsFound.add(product); else productsFound = UtilMisc.toList(product); } @@ -909,7 +909,7 @@ public final class ProductWorker { public static String findProductId(Delegator delegator, String idToFind, String goodIdentificationTypeId) throws GenericEntityException { GenericValue product = findProduct(delegator, idToFind, goodIdentificationTypeId); - if (UtilValidate.isNotEmpty(product)) { + if (product != null) { return product.getString("productId"); } else { return null; @@ -1097,7 +1097,7 @@ nextProd: .filterByDate().queryList(); if (UtilValidate.isNotEmpty(productFeaturePrices)) { GenericValue productFeaturePrice = productFeaturePrices.get(0); - if (UtilValidate.isNotEmpty(productFeaturePrice)) { + if (productFeaturePrice != null) { productPrice.put("price", productPrice.getBigDecimal("price").add(productFeaturePrice.getBigDecimal("price"))); } } diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreEvents.java b/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreEvents.java index 745488fb43..a90635385c 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreEvents.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreEvents.java @@ -50,7 +50,7 @@ public class ProductStoreEvents { try { GenericValue productStoreGroup = EntityQuery.use(delegator).from("ProductStoreGroup").where("productStoreGroupId", parentGroupId).cache(true).queryOne(); - if (UtilValidate.isNotEmpty(productStoreGroup)) { + if (productStoreGroup != null) { children = EntityQuery.use(delegator).from("ProductStoreGroupRollupAndChild").where("parentGroupId", parentGroupId).cache(true).filterByDate().queryList(); if (UtilValidate.isNotEmpty(children)) { for (GenericValue child : children ) { diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java index 9ad2903226..b3c0ec43e1 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java @@ -1222,7 +1222,7 @@ public class ShipmentServices { .where("productStoreId",productStoreId, "shipmentMethodTypeId", shipmentMethodTypeId, "partyId", carrierPartyId, "roleTypeId", carrierRoleTypeId) .queryFirst(); - if (UtilValidate.isNotEmpty(productStoreShipmentMeth)) { + if (productStoreShipmentMeth != null) { shipmentGatewayConfig.put("shipmentGatewayConfigId", productStoreShipmentMeth.getString("shipmentGatewayConfigId")); shipmentGatewayConfig.put("configProps", productStoreShipmentMeth.getString("configProps")); } else { diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java index 1f58f51072..c0de72c834 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java @@ -1065,7 +1065,7 @@ public class FedexServices { if (UtilValidate.isNotEmpty(shipmentGatewayConfigId)) { try { GenericValue fedex = EntityQuery.use(delegator).from("ShipmentGatewayFedex").where("shipmentGatewayConfigId", shipmentGatewayConfigId).queryOne(); - if (UtilValidate.isNotEmpty(fedex)) { + if (fedex != null) { Object fedexField = fedex.get(shipmentGatewayConfigParameterName); if (fedexField != null) { returnValue = fedexField.toString().trim(); diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java index 81815fc2e7..d9a61f00c9 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java @@ -515,13 +515,13 @@ public class UpsServices { UtilXml.addChildElementValue(dimensionsElement, "Length", UtilValidate.isNotEmpty(boxLength) ? ""+boxLength.intValue() : "", shipmentConfirmRequestDoc); UtilXml.addChildElementValue(dimensionsElement, "Width", UtilValidate.isNotEmpty(boxWidth) ? ""+boxWidth.intValue() : "", shipmentConfirmRequestDoc); UtilXml.addChildElementValue(dimensionsElement, "Height", UtilValidate.isNotEmpty(boxHeight) ? ""+boxHeight.intValue() : "", shipmentConfirmRequestDoc); - } else if (UtilValidate.isNotEmpty(shipmentPackage) && UtilValidate.isNotEmpty(shipmentPackage.getBigDecimal("boxLength")) + } else if (shipmentPackage != null && UtilValidate.isNotEmpty(shipmentPackage.getBigDecimal("boxLength")) && UtilValidate.isNotEmpty(shipmentPackage.getBigDecimal("boxWidth")) && UtilValidate.isNotEmpty(shipmentPackage.getBigDecimal("boxHeight"))) { Element dimensionsElement = UtilXml.addChildElement(packageElement, "Dimensions", shipmentConfirmRequestDoc); Element unitOfMeasurementElement = UtilXml.addChildElement(dimensionsElement, "UnitOfMeasurement", shipmentConfirmRequestDoc); GenericValue dimensionUom = shipmentPackage.getRelatedOne("DimensionUom", false); - if (UtilValidate.isNotEmpty(dimensionUom)) { + if (dimensionUom != null) { UtilXml.addChildElementValue(unitOfMeasurementElement, "Code", dimensionUom.getString("abbreviation").toUpperCase(), shipmentConfirmRequestDoc); } else { UtilXml.addChildElementValue(unitOfMeasurementElement, "Code", "IN", shipmentConfirmRequestDoc); diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java index df5fd94e7a..a46921e915 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java @@ -1766,7 +1766,7 @@ public class UspsServices { if (UtilValidate.isNotEmpty(shipmentGatewayConfigId)) { try { GenericValue usps = EntityQuery.use(delegator).from("ShipmentGatewayUsps").where("shipmentGatewayConfigId", shipmentGatewayConfigId).queryOne(); - if (UtilValidate.isNotEmpty(usps)) { + if (usps != null) { Object uspsField = usps.get(shipmentGatewayConfigParameterName); if (uspsField != null) { returnValue = uspsField.toString().trim(); diff --git a/applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java b/applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java index f4b685948d..58eac4a89d 100644 --- a/applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java +++ b/applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java @@ -121,7 +121,7 @@ public class LoginEvents { try { GenericValue userLoginSecurityQuestion = delegator.findOne("UserLoginSecurityQuestion", UtilMisc.toMap("questionEnumId", questionEnumId, "userLoginId", userLoginId), true); - if (UtilValidate.isNotEmpty(userLoginSecurityQuestion)) { + if (userLoginSecurityQuestion != null) { if (UtilValidate.isEmpty(securityAnswer)) { errMsg = UtilProperties.getMessage(resource, "loginservices.security_answer_empty", UtilHttp.getLocale(request)); request.setAttribute("_ERROR_MESSAGE_", errMsg); diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtilProperties.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtilProperties.java index c10d9a742f..2e141c3eee 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtilProperties.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtilProperties.java @@ -227,7 +227,7 @@ public final class EntityUtilProperties implements Serializable { .from("SystemProperty") .where("systemResourceId", resourceName, "systemPropertyId", name) .queryOne(); - if (UtilValidate.isNotEmpty(gv)) { + if (gv != null) { prevValue = gv.getString("systemPropertyValue"); gv.set("systemPropertyValue", value); } else { diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/mail/JavaMailContainer.java b/framework/service/src/main/java/org/apache/ofbiz/service/mail/JavaMailContainer.java index 4efac0675c..1b5a69bfc0 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/mail/JavaMailContainer.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/mail/JavaMailContainer.java @@ -131,7 +131,7 @@ public class JavaMailContainer implements Container { } // start the polling timer - if (UtilValidate.isNotEmpty(stores)) { + if (stores != null) { pollTimer.scheduleAtFixedRate(new PollerTask(dispatcher, userLogin), timerDelay, timerDelay, TimeUnit.MILLISECONDS); } else { Debug.logWarning("No JavaMail Store(s) configured; poller disabled.", module); @@ -296,7 +296,7 @@ public class JavaMailContainer implements Container { @Override public void run() { - if (UtilValidate.isNotEmpty(stores)) { + if (stores != null) { for (Map.Entry entry: stores.entrySet()) { Store store = entry.getKey(); Session session = entry.getValue(); diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/portal/PortalPageWorker.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/portal/PortalPageWorker.java index ff55cd4783..fa3a1c6e09 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/portal/PortalPageWorker.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/portal/PortalPageWorker.java @@ -152,7 +152,7 @@ public class PortalPageWorker { if (UtilValidate.isNotEmpty(portalPageId)) { GenericValue userLogin = (GenericValue) context.get("userLogin"); - if (UtilValidate.isNotEmpty(userLogin)) { + if (userLogin != null) { String userLoginId = (String) userLogin.get("userLoginId"); Security security = (Security) context.get("security"); @@ -160,7 +160,7 @@ public class PortalPageWorker { try { Delegator delegator = WidgetWorker.getDelegator(context); GenericValue portalPage = EntityQuery.use(delegator).from("PortalPage").where("portalPageId", portalPageId).queryOne(); - if (UtilValidate.isNotEmpty(portalPage)) { + if (portalPage != null) { String ownerUserLoginId = (String) portalPage.get("ownerUserLoginId"); // Users with PORTALPAGE_ADMIN permission can configure every Portal Page userIsAllowed = (ownerUserLoginId.equals(userLoginId) || hasPortalAdminPermission); diff --git a/specialpurpose/cmssite/src/main/java/org/apache/ofbiz/cmssite/multisite/WebSiteFilter.java b/specialpurpose/cmssite/src/main/java/org/apache/ofbiz/cmssite/multisite/WebSiteFilter.java index 670190f00d..02916f8913 100644 --- a/specialpurpose/cmssite/src/main/java/org/apache/ofbiz/cmssite/multisite/WebSiteFilter.java +++ b/specialpurpose/cmssite/src/main/java/org/apache/ofbiz/cmssite/multisite/WebSiteFilter.java @@ -80,7 +80,7 @@ public class WebSiteFilter implements Filter { GenericValue webSite = null; try { - if (UtilValidate.isNotEmpty(webSiteAlias) && UtilValidate.isEmpty(webSite)) { + if (UtilValidate.isNotEmpty(webSiteAlias) && webSite != null) { webSite = EntityQuery.use(delegator).from("WebSite").where("hostedPathAlias", webSiteAlias).cache().queryFirst(); } if (UtilValidate.isEmpty(webSite)) { diff --git a/specialpurpose/ebay/src/main/java/org/apache/ofbiz/ebay/EbayHelper.java b/specialpurpose/ebay/src/main/java/org/apache/ofbiz/ebay/EbayHelper.java index 6d1dad6f64..bdd3cae9af 100644 --- a/specialpurpose/ebay/src/main/java/org/apache/ofbiz/ebay/EbayHelper.java +++ b/specialpurpose/ebay/src/main/java/org/apache/ofbiz/ebay/EbayHelper.java @@ -74,7 +74,7 @@ public class EbayHelper { String errMsg = UtilProperties.getMessage(resource, "buildEbayConfig.unableToFindEbayConfig" + e.getMessage(), locale); return ServiceUtil.returnError(errMsg); } - if (UtilValidate.isNotEmpty(eBayConfig)) { + if (eBayConfig != null) { buildEbayConfigContext.put("devID", eBayConfig.getString("devId")); buildEbayConfigContext.put("appID", eBayConfig.getString("appId")); buildEbayConfigContext.put("certID", eBayConfig.getString("certId")); @@ -172,7 +172,7 @@ public class EbayHelper { String shipmentMethodTypeId = "NO_SHIPPING"; try { GenericValue ebayShippingMethod = EntityQuery.use(delegator).from("EbayShippingMethod").where("shipmentMethodName", shippingService, "productStoreId", productStoreId).queryOne(); - if (UtilValidate.isNotEmpty(ebayShippingMethod)) { + if (ebayShippingMethod != null) { partyId = ebayShippingMethod.getString("carrierPartyId"); shipmentMethodTypeId = ebayShippingMethod.getString("shipmentMethodTypeId"); } else { @@ -297,7 +297,7 @@ public class EbayHelper { String partyId = null; try { - if (UtilValidate.isNotEmpty(name) && UtilValidate.isNotEmpty(userLogin)) { + if (UtilValidate.isNotEmpty(name) && userLogin != null) { Debug.logVerbose("Creating Customer Party: " + name, module); // Try to split the lastname from the firstname @@ -624,7 +624,7 @@ public class EbayHelper { } if (UtilValidate.isNotEmpty(titleFirstWord)) { GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", titleFirstWord).queryOne(); - if (UtilValidate.isNotEmpty(product)) { + if (product != null) { productId = product.getString("productId"); } } diff --git a/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayEvents.java b/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayEvents.java index adff8e259d..a0fa5ed228 100644 --- a/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayEvents.java +++ b/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayEvents.java @@ -863,7 +863,7 @@ public class EbayEvents { if (UtilValidate.isNotEmpty(requestParams.get("requireEbayInventory")) && "Y".equals(requestParams.get("requireEbayInventory").toString())) { GenericValue ebayProductStore = EntityQuery.use(delegator).from("EbayProductStoreInventory").where("productStoreId", productStoreId, "productId", productId).filterByDate().queryFirst(); - if (UtilValidate.isNotEmpty(ebayProductStore)) { + if (ebayProductStore != null) { String facilityId = ebayProductStore.getString("facilityId"); BigDecimal atp = ebayProductStore.getBigDecimal("availableToPromiseListing"); int intAtp = atp.intValue(); @@ -899,11 +899,11 @@ public class EbayEvents { } try { GenericValue storeRole = EntityQuery.use(delegator).from("ProductStoreRole").where("productStoreId", productStoreId, "roleTypeId", "EBAY_ACCOUNT").queryFirst(); - if (UtilValidate.isNotEmpty(storeRole)) { + if (storeRole != null) { GenericValue eBayUserLogin = EntityQuery.use(delegator).from("UserLogin") .where("partyId", storeRole.get("partyId")) .queryFirst(); - if (UtilValidate.isNotEmpty(eBayUserLogin)) { + if (eBayUserLogin != null) { prodMap.put("userLoginId", eBayUserLogin.get("userLoginId").toString()); } } diff --git a/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java b/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java index 1af510db2e..61d9736962 100644 --- a/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java +++ b/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java @@ -1550,7 +1550,7 @@ public class EbayStore { String facilityId = ""; if (UtilValidate.isNotEmpty(context.get("requireEbayInventory")) && "on".equals(context.get("requireEbayInventory").toString())) { GenericValue ebayProductStore = EntityQuery.use(delegator).from("EbayProductStoreInventory").where("productStoreId", context.get("productStoreId").toString(), "productId", context.get("productId")).filterByDate().queryFirst(); - if (UtilValidate.isNotEmpty(ebayProductStore)) { + if (ebayProductStore != null) { facilityId = ebayProductStore.getString("facilityId"); BigDecimal atp = ebayProductStore.getBigDecimal("availableToPromiseListing"); intAtp = atp.intValue(); @@ -1563,9 +1563,9 @@ public class EbayStore { GenericValue userLogin = (GenericValue) context.get("userLogin"); if (UtilValidate.isNotEmpty(context.get("productCategoryId"))) { GenericValue prodCategoryMember = EntityQuery.use(delegator).from("ProductCategoryMember").where("productCategoryId", context.get("productCategoryId"),"productId", context.get("productId")).filterByDate().queryFirst(); - if (UtilValidate.isNotEmpty(prodCategoryMember)) { + if (prodCategoryMember != null) { GenericValue prodCategoryRole = EntityQuery.use(delegator).from("ProductCategoryRole").where("productCategoryId", prodCategoryMember.get("productCategoryId").toString(), "partyId", userLogin.get("partyId"),"roleTypeId", "EBAY_ACCOUNT").filterByDate().queryFirst(); - if (UtilValidate.isNotEmpty(prodCategoryRole)) { + if (prodCategoryRole != null) { context.put("ebayCategory", prodCategoryRole.get("comments")); } else { result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_FAIL); @@ -1578,9 +1578,9 @@ public class EbayStore { while (prodCategoryMemberIter.hasNext()) { GenericValue prodCategory = prodCategoryMemberIter.next(); GenericValue prodCatalogCategory = EntityQuery.use(delegator).from("ProdCatalogCategory").where("prodCatalogId", context.get("prodCatalogId"), "productCategoryId", prodCategory.get("productCategoryId").toString()).filterByDate().queryFirst(); - if (UtilValidate.isNotEmpty(prodCatalogCategory)) { + if (prodCatalogCategory != null) { GenericValue prodCategoryRole = EntityQuery.use(delegator).from("ProductCategoryRole").where("productCategoryId", prodCatalogCategory.get("productCategoryId").toString(), "partyId", userLogin.get("partyId"),"roleTypeId", "EBAY_ACCOUNT").filterByDate().queryFirst(); - if (UtilValidate.isNotEmpty(prodCategoryRole)) { + if (prodCategoryRole != null) { context.put("ebayCategory", prodCategoryRole.get("comments")); } else { result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_FAIL); @@ -2471,7 +2471,7 @@ public class EbayStore { boolean checkResult = false; try { GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); - if(UtilValidate.isNotEmpty(product)) { + if(product != null) { checkResult = true; } } catch(GenericEntityException e) { diff --git a/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java b/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java index ad02da5d5d..007b9edc48 100644 --- a/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java +++ b/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java @@ -143,7 +143,7 @@ public class EbayStoreAutoPreferences { try { ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator); ebayProductStorePref = EntityQuery.use(delegator).from("EbayProductStorePref").where("productStoreId", productStoreId, "autoPrefEnumId", "EBAY_AUTO_PIT_FB").queryOne(); - if (UtilValidate.isNotEmpty(ebayProductStorePref) && UtilValidate.isNotEmpty(ebayProductStorePref.getString("autoPrefJobId"))) { + if (ebayProductStorePref != null && UtilValidate.isNotEmpty(ebayProductStorePref.getString("autoPrefJobId"))) { isAutoPositiveFeedback = ebayProductStorePref.getString("enabled"); // if isAutoPositiveFeedback is N that means not start this job run service if ("Y".equals(isAutoPositiveFeedback) && jobId.equals(ebayProductStorePref.getString("autoPrefJobId"))) { @@ -272,7 +272,7 @@ public class EbayStoreAutoPreferences { ebayProductStorePref = EntityQuery.use(delegator).from("EbayProductStorePref").where("productStoreId", productStoreId, "autoPrefEnumId", "EBAY_AUTO_PIT_FB").queryOne(); context.put("productStoreId", productStoreId); context.put("autoPrefEnumId", "EBAY_AUTO_PIT_FB"); - if (UtilValidate.isNotEmpty(ebayProductStorePref) && UtilValidate.isNotEmpty(ebayProductStorePref.getString("autoPrefJobId"))) { + if (ebayProductStorePref != null && UtilValidate.isNotEmpty(ebayProductStorePref.getString("autoPrefJobId"))) { autoPrefJobId = ebayProductStorePref.getString("autoPrefJobId"); } context.put("autoPrefJobId", autoPrefJobId); @@ -748,7 +748,7 @@ public class EbayStoreAutoPreferences { if (sellingManagerSoldOrders != null) { int soldOrderLength = sellingManagerSoldOrders.length; GenericValue ebayPref = EntityQuery.use(delegator).from("EbayProductStorePref").where("productStoreId", productStoreId, "autoPrefEnumId", "ENA_COMB_ORD").queryOne(); - if (UtilValidate.isNotEmpty(ebayPref)) { + if (ebayPref != null) { Timestamp beginDate = UtilDateTime.toTimestamp("01/01/2001 00:00:00"); Long daysCount = Long.parseLong(ebayPref.get("condition1").toString()); diff --git a/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java b/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java index 4056bc7b9a..9650172514 100644 --- a/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java +++ b/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java @@ -624,7 +624,7 @@ public class EbayStoreHelper { GetOrdersResponseType resp = null; try { GenericValue orderHeader = EntityQuery.use(delegator).from("OrderHeader").where("orderId", orderId).queryOne(); - if (UtilValidate.isNotEmpty(orderHeader)) { + if (orderHeader != null) { String externalId = orderHeader.getString("externalId").toString(); List orderShipment = orderHeader.getRelated("OrderShipment", null, null, false); if (orderShipment.size() > 0) { @@ -725,7 +725,7 @@ public class EbayStoreHelper { boolean isReserve = false; try { GenericValue ebayProductStore = EntityQuery.use(delegator).from("EbayProductStoreInventory").where("productStoreId", productStoreId, "productId", productId).filterByDate().queryFirst(); - if (UtilValidate.isNotEmpty(ebayProductStore)) { + if (ebayProductStore != null) { BigDecimal atp = ebayProductStore.getBigDecimal("availableToPromiseListing"); int intAtp = atp.intValue(); if (intAtp > 0) { diff --git a/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOrder.java b/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOrder.java index 0e9946917c..1b3ada7987 100644 --- a/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOrder.java +++ b/specialpurpose/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOrder.java @@ -105,7 +105,7 @@ public class EbayStoreOrder { return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "ordersImportFromEbay.productStoreIdIsMandatory", locale)); } else { GenericValue productStore = EntityQuery.use(delegator).from("ProductStore").where("productStoreId", productStoreId).queryOne(); - if (UtilValidate.isNotEmpty(productStore)) { + if (productStore != null) { defaultCurrencyUomId = productStore.getString("defaultCurrencyUomId"); payToPartyId = productStore.getString("payToPartyId"); facilityId = productStore.getString("inventoryFacilityId"); @@ -173,7 +173,7 @@ public class EbayStoreOrder { BigDecimal shippingAmount = new BigDecimal(shippingCost); if (shippingAmount.doubleValue() > 0) { GenericValue shippingAdjustment = EbayHelper.makeOrderAdjustment(delegator, "SHIPPING_CHARGES", cart.getOrderId(), null, null, shippingAmount.doubleValue(), 0.0); - if (UtilValidate.isNotEmpty(shippingAdjustment)) { + if (shippingAdjustment != null) { cart.addAdjustment(shippingAdjustment); } } @@ -200,7 +200,7 @@ public class EbayStoreOrder { salesPercent = new Double(salesTaxPercent).doubleValue(); } GenericValue salesTaxAdjustment = EbayHelper.makeOrderAdjustment(delegator, "SALES_TAX", cart.getOrderId(), null, null, salesTaxAmountTotal, salesPercent); - if (UtilValidate.isNotEmpty(salesTaxAdjustment)) { + if (salesTaxAdjustment != null) { cart.addAdjustment(salesTaxAdjustment); } } @@ -216,7 +216,7 @@ public class EbayStoreOrder { } // if we get a party, check its contact information. - if (UtilValidate.isNotEmpty(partyAttribute)) { + if (partyAttribute != null) { partyId = (String) partyAttribute.get("partyId"); Debug.logInfo("Found existing party associated to the eBay buyer: " + partyId, module); GenericValue party = EntityQuery.use(delegator).from("Party").where("partyId", partyId).queryOne(); @@ -444,7 +444,7 @@ public class EbayStoreOrder { GenericValue partyAttribute = null; if (UtilValidate.isNotEmpty(context.get("eiasTokenBuyer"))) { partyAttribute = EntityQuery.use(delegator).from("PartyAttribute").where("attrValue", (String) context.get("eiasTokenBuyer")).queryFirst(); - if (UtilValidate.isNotEmpty(partyAttribute)) { + if (partyAttribute != null) { partyId = (String) partyAttribute.get("partyId"); } } diff --git a/specialpurpose/ecommerce/src/main/java/org/apache/ofbiz/ecommerce/janrain/JanrainHelper.java b/specialpurpose/ecommerce/src/main/java/org/apache/ofbiz/ecommerce/janrain/JanrainHelper.java index fc5e813cc9..c2e317ff1d 100644 --- a/specialpurpose/ecommerce/src/main/java/org/apache/ofbiz/ecommerce/janrain/JanrainHelper.java +++ b/specialpurpose/ecommerce/src/main/java/org/apache/ofbiz/ecommerce/janrain/JanrainHelper.java @@ -231,7 +231,7 @@ public class JanrainHelper { try { GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", preferredUsername).cache().queryOne(); - if (UtilValidate.isNotEmpty(userLogin)) { + if (userLogin != null) { LoginWorker.doBasicLogin(userLogin, request); LoginWorker.autoLoginSet(request, response); return "success"; diff --git a/specialpurpose/passport/src/main/java/org/apache/ofbiz/passport/event/LinkedInEvents.java b/specialpurpose/passport/src/main/java/org/apache/ofbiz/passport/event/LinkedInEvents.java index cd21696c3c..00397d6822 100644 --- a/specialpurpose/passport/src/main/java/org/apache/ofbiz/passport/event/LinkedInEvents.java +++ b/specialpurpose/passport/src/main/java/org/apache/ofbiz/passport/event/LinkedInEvents.java @@ -252,7 +252,7 @@ public class LinkedInEvents { request.setAttribute("_ERROR_MESSAGE_", e.getMessage()); return "error"; } - if (UtilValidate.isNotEmpty(linkedInUser)) { + if (linkedInUser != null) { boolean dataChanged = false; if (!accessToken.equals(linkedInUser.getString("accessToken"))) { linkedInUser.set("accessToken", accessToken); diff --git a/specialpurpose/passport/src/main/java/org/apache/ofbiz/passport/user/LinkedInAuthenticator.java b/specialpurpose/passport/src/main/java/org/apache/ofbiz/passport/user/LinkedInAuthenticator.java index 913c583dbc..41c7ccce4e 100644 --- a/specialpurpose/passport/src/main/java/org/apache/ofbiz/passport/user/LinkedInAuthenticator.java +++ b/specialpurpose/passport/src/main/java/org/apache/ofbiz/passport/user/LinkedInAuthenticator.java @@ -105,7 +105,7 @@ public class LinkedInAuthenticator implements Authenticator { GenericValue userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", userLoginId), false); String externalAuthId = userLogin.getString("externalAuthId"); GenericValue linkedInUser = delegator.findOne("LinkedInUser", UtilMisc.toMap("linedInUserId", externalAuthId), false); - if (UtilValidate.isNotEmpty(linkedInUser)) { + if (linkedInUser != null) { String accessToken = linkedInUser.getString("accessToken"); if (UtilValidate.isNotEmpty(accessToken)) { getMethod = new HttpGet(LinkedInEvents.TokenEndpoint + LinkedInEvents.UserApiUri + "?oauth2_access_token=" + accessToken); @@ -217,7 +217,7 @@ public class LinkedInAuthenticator implements Authenticator { GenericValue userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", userLoginId), false); String externalAuthId = userLogin.getString("externalAuthId"); GenericValue linkedInUser = delegator.findOne("LinkedInUser", UtilMisc.toMap("linkedInUserId", externalAuthId), false); - if (UtilValidate.isNotEmpty(linkedInUser)) { + if (linkedInUser != null) { String accessToken = linkedInUser.getString("accessToken"); if (UtilValidate.isNotEmpty(accessToken)) { getMethod = new HttpGet(LinkedInEvents.TokenEndpoint + LinkedInEvents.UserApiUri + "?oauth2_access_token=" + accessToken); diff --git a/specialpurpose/scrum/src/main/java/org/apache/ofbiz/scrum/ScrumServices.java b/specialpurpose/scrum/src/main/java/org/apache/ofbiz/scrum/ScrumServices.java index 538d1ad0d3..91923906c7 100644 --- a/specialpurpose/scrum/src/main/java/org/apache/ofbiz/scrum/ScrumServices.java +++ b/specialpurpose/scrum/src/main/java/org/apache/ofbiz/scrum/ScrumServices.java @@ -73,7 +73,7 @@ public class ScrumServices { String productId = subject.substring(pdLocation + 3, nonDigitLocation); // Debug.logInfo("=======================Product id found in subject: >>" + custRequestId + "<<", module); GenericValue product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); - if (UtilValidate.isNotEmpty(product)) { + if (product != null) { GenericValue communicationEventProductMap = EntityQuery.use(delegator).from("CommunicationEventProduct").where("productId", productId, "communicationEventId", communicationEventId).queryOne(); if (UtilValidate.isEmpty(communicationEventProductMap)) { GenericValue communicationEventProduct = delegator.makeValue("CommunicationEventProduct", UtilMisc.toMap("productId", productId, "communicationEventId", communicationEventId)); diff --git a/specialpurpose/webpos/src/main/java/org/apache/ofbiz/webpos/WebPosEvents.java b/specialpurpose/webpos/src/main/java/org/apache/ofbiz/webpos/WebPosEvents.java index a8466d2dae..9fa97f4329 100755 --- a/specialpurpose/webpos/src/main/java/org/apache/ofbiz/webpos/WebPosEvents.java +++ b/specialpurpose/webpos/src/main/java/org/apache/ofbiz/webpos/WebPosEvents.java @@ -62,7 +62,7 @@ public class WebPosEvents { String responseString = LoginEvents.storeLogin(request, response); GenericValue userLoginNew = (GenericValue)session.getAttribute("userLogin"); - if (UtilValidate.isNotEmpty(userLoginNew) && UtilValidate.isNotEmpty(posTerminalId)) { + if (userLoginNew != null && UtilValidate.isNotEmpty(posTerminalId)) { webPosSession.setUserLogin(userLoginNew); } return responseString; @@ -93,14 +93,14 @@ public class WebPosEvents { String facilityId = null; String currencyUomId = request.getParameter("currencyUomId"); - if (UtilValidate.isNotEmpty(productStore)) { + if (productStore != null) { facilityId = productStore.getString("inventoryFacilityId"); if (UtilValidate.isEmpty(currencyUomId)) { currencyUomId = productStore.getString("defaultCurrencyUomId"); } } - if (UtilValidate.isNotEmpty(userLogin)) { + if (userLogin != null) { session.setAttribute("userLogin", userLogin); } @@ -162,7 +162,7 @@ public class WebPosEvents { try { String productId = request.getParameter("productId"); product = EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne(); - if (UtilValidate.isNotEmpty(product)) { + if (product != null) { request.setAttribute("product", product); if (UtilValidate.isNotEmpty(product.getString("isVirtual")) && "Y".equalsIgnoreCase(product.getString("isVirtual"))) { String virtualVariantMethodEnum = product.getString("virtualVariantMethodEnum"); @@ -188,7 +188,7 @@ public class WebPosEvents { for (int i=0; i < featureOrder.size(); i++) { String featureKey = featureOrder.get(i); GenericValue featureValue = EntityQuery.use(delegator).from("ProductFeatureType").where("productFeatureTypeId", featureOrder.get(i)).cache().queryOne(); - if (UtilValidate.isNotEmpty(featureValue) && + if (featureValue != null && UtilValidate.isNotEmpty(featureValue.get("description"))) { featureTypes.put(featureKey, featureValue.get("description")); } else {