Author: jleroux
Date: Mon Nov 23 21:48:18 2009 New Revision: 883508 URL: http://svn.apache.org/viewvc?rev=883508&view=rev Log: ComUse UtilValidate.isEmpty methods instead of (obj == null) || (obj.length == 0) Complete r883507 Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleMapAccessor.java ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/seleniumxml/RemoteRequest.java Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java?rev=883508&r1=883507&r2=883508&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java Mon Nov 23 21:48:18 2009 @@ -412,7 +412,7 @@ public static boolean isProductInCategory(Delegator delegator, String productId, String productCategoryId) throws GenericEntityException { if (productCategoryId == null) return false; - if (productId == null || productId.length() == 0) return false; + if (UtilValidate.isEmpty(productId)) return false; List<GenericValue> productCategoryMembers = EntityUtil.filterByDate(delegator.findByAndCache("ProductCategoryMember", UtilMisc.toMap("productCategoryId", productCategoryId, "productId", productId)), true); Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java?rev=883508&r1=883507&r2=883508&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductServices.java Mon Nov 23 21:48:18 2009 @@ -381,7 +381,7 @@ Locale locale = (Locale) context.get("locale"); String errMsg = null; - if (productId == null || productId.length() == 0) { + if (UtilValidate.isEmpty(productId)) { errMsg = UtilProperties.getMessage(resource,"productservices.invalid_productId_passed", locale); result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR); result.put(ModelService.ERROR_MESSAGE, errMsg); Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleMapAccessor.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleMapAccessor.java?rev=883508&r1=883507&r2=883508&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleMapAccessor.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleMapAccessor.java Mon Nov 23 21:48:18 2009 @@ -25,6 +25,7 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilGenerics; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.cache.UtilCache; import org.ofbiz.base.util.string.FlexibleStringExpander; import org.ofbiz.base.util.string.UelUtil; @@ -77,7 +78,7 @@ */ @SuppressWarnings("unchecked") public static <T> FlexibleMapAccessor<T> getInstance(String original) { - if (original == null || original.length() == 0 || "null".equals(original)) { + if (UtilValidate.isEmpty(original) || "null".equals(original)) { return nullFma; } FlexibleMapAccessor fma = fmaCache.get(original); Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java?rev=883508&r1=883507&r2=883508&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/envops/SetOperation.java Mon Nov 23 21:48:18 2009 @@ -124,7 +124,7 @@ + (this.valueExdr.isEmpty() ? "" : "\" value=\"" + this.valueExdr.getOriginal()) + (this.fromField.isEmpty() ? "" : "\" from-field=\"" + this.fromField) + (this.defaultExdr.isEmpty() ? "" : "\" default-value=\"" + this.defaultExdr.getOriginal()) - + (this.type == null || this.type.length() == 0 ? "" : "\" type=\"" + this.type) + + (UtilValidate.isEmpty(this.type) ? "" : "\" type=\"" + this.type) + "\"/>"; } @Override Modified: ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/seleniumxml/RemoteRequest.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/seleniumxml/RemoteRequest.java?rev=883508&r1=883507&r2=883508&view=diff ============================================================================== --- ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/seleniumxml/RemoteRequest.java (original) +++ ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/seleniumxml/RemoteRequest.java Mon Nov 23 21:48:18 2009 @@ -151,7 +151,7 @@ } else if (nm.equals("param-out")) { name = elem.getAttributeValue("result-name"); fieldName = elem.getAttributeValue("field-name"); - if (fieldName == null || fieldName.length() == 0) { + if (UtilValidate.isEmpty(fieldName)) { fieldName = name; } this.outMap.put(name, fieldName); |
Free forum by Nabble | Edit this page |