Administrator
|
There has been some errors in this patch, I'm fixing them...
Fortunately it's not too big... Jacques > Author: jleroux > Date: Sat Nov 28 13:31:52 2009 > New Revision: 885091 > > URL: http://svn.apache.org/viewvc?rev=885091&view=rev > Log: > More uses of isEmpty(expr) instead of (expr == null) || (expr.size() == 0 > > Modified: > ofbiz/trunk/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java > ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java > ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java > ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java > ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilNumber.java > ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/WebappPropertyToField.java > > Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java?rev=885091&r1=885090&r2=885091&view=diff > ============================================================================== > --- ofbiz/trunk/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java (original) > +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java Sat Nov 28 13:31:52 2009 > @@ -156,7 +156,7 @@ > List accounts = delegator.findByAnd("FinAccount", UtilMisc.toMap("finAccountCode", encryptedFinAccountCode)); > accounts = EntityUtil.filterByDate(accounts); > > - if ((accounts == null) || (accounts.size() == 0)) { > + if (UtilValidate.isNotEmpty(accounts)) { > // OK to display - not a code anyway > Debug.logWarning("No fin account found for account code [" + finAccountCode + "]", module); > return null; > > Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=885091&r1=885090&r2=885091&view=diff > ============================================================================== > --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original) > +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Sat Nov 28 13:31:52 2009 > @@ -337,7 +337,7 @@ > */ > public Long getOrderTermNetDays() { > List<GenericValue> orderTerms = EntityUtil.filterByAnd(getOrderTerms(), UtilMisc.toMap("termTypeId", "FIN_PAYMENT_TERM")); > - if ((orderTerms == null) || (orderTerms.size() == 0)) { > + if (UtilValidate.isNotEmpty(orderTerms)) { > return null; > } else if (orderTerms.size() > 1) { > Debug.logWarning("Found " + orderTerms.size() + " FIN_PAYMENT_TERM order terms for orderId [" + getOrderId() + "], > using the first one ", module); > > Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=885091&r1=885090&r2=885091&view=diff > ============================================================================== > --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original) > +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Sat Nov 28 13:31:52 2009 > @@ -3110,7 +3110,7 @@ > List allProductContent = product.getRelated("ProductContent"); > > // try looking up the parent product if the product has no content and is a variant > - if (((allProductContent == null) || allProductContent.size() == 0) && > ("Y".equals(product.getString("isVariant")))) { > + if (UtilValidate.isNotEmpty(allProductContent) && ("Y".equals(product.getString("isVariant")))) { > GenericValue parentProduct = ProductWorker.getParentProduct(product.getString("productId"), delegator); > if (allProductContent == null) { > allProductContent = FastList.newInstance(); > > Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=885091&r1=885090&r2=885091&view=diff > ============================================================================== > --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original) > +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Sat Nov 28 13:31:52 2009 > @@ -457,7 +457,7 @@ > } > if (cart.isPinRequiredForGC(delegator)) { > // if a PIN is required, make sure the PIN is valid > - if ((gcPin == null) || (gcPin.length() == 0)) { > + if (UtilValidate.isNotEmpty((gcPin)) { > errMsg = UtilProperties.getMessage(resource_error,"checkhelper.enter_gift_card_pin_number", (cart != null ? > cart.getLocale() : Locale.getDefault())); > errorMessages.add(errMsg); > gcFieldsOkay = false; > > Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilNumber.java > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilNumber.java?rev=885091&r1=885090&r2=885091&view=diff > ============================================================================== > --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilNumber.java (original) > +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilNumber.java Sat Nov 28 13:31:52 2009 > @@ -43,8 +43,8 @@ > * @return int - Scale factor to pass to BigDecimal's methods. Defaults to DEFAULT_BD_SCALE (2) > */ > public static int getBigDecimalScale(String file, String property) { > - if ((file == null) || (file.length() == 0)) return DEFAULT_BD_SCALE; > - if ((property == null) || (property.length() == 0)) return DEFAULT_BD_SCALE; > + if (UtilValidate.isNotEmpty((file)) return DEFAULT_BD_SCALE; > + if (UtilValidate.isNotEmpty((property)) return DEFAULT_BD_SCALE; > > int scale = -1; > String value = UtilProperties.getPropertyValue(file, property); > @@ -75,8 +75,8 @@ > * @return int - Rounding mode to pass to BigDecimal's methods. Defaults to DEFAULT_BD_ROUNDING_MODE > (BigDecimal.ROUND_HALF_UP) > */ > public static int getBigDecimalRoundingMode(String file, String property) { > - if ((file == null) || (file.length() == 0)) return DEFAULT_BD_SCALE; > - if ((property == null) || (property.length() == 0)) return DEFAULT_BD_ROUNDING_MODE; > + if (UtilValidate.isNotEmpty(file)) return DEFAULT_BD_SCALE; > + if (UtilValidate.isNotEmpty(property)) return DEFAULT_BD_ROUNDING_MODE; > > String value = UtilProperties.getPropertyValue(file, property); > int mode = roundingModeFromString(value); > > Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/WebappPropertyToField.java > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/WebappPropertyToField.java?rev=885091&r1=885090&r2=885091&view=diff > ============================================================================== > --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/WebappPropertyToField.java (original) > +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/eventops/WebappPropertyToField.java Sat Nov 28 13:31:52 2009 > @@ -91,7 +91,7 @@ > } > > // if fieldVal is null, or has zero length, use defaultVal > - if ((fieldVal == null) || (fieldVal.length() == 0)) { > + if (UtilValidate.isNotEmpty((fieldVal)) { > fieldVal = defaultVal; > } > > > |
Free forum by Nabble | Edit this page |