svn commit: r1169478 - in /ofbiz/trunk: applications/content/src/org/ofbiz/content/content/ applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ applications/marketing/src/org/ofbiz/sfa/vcard/ applications/order/src/org/ofbiz/order/order/...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1169478 - in /ofbiz/trunk: applications/content/src/org/ofbiz/content/content/ applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ applications/marketing/src/org/ofbiz/sfa/vcard/ applications/order/src/org/ofbiz/order/order/...

jleroux@apache.org
Author: jleroux
Date: Sun Sep 11 17:06:11 2011
New Revision: 1169478

URL: http://svn.apache.org/viewvc?rev=1169478&view=rev
Log:
No functional changes, simple code refactoring around UtilValidate.is(Not)Empty()

Changes implementation of UtilValidate.isEmpty() for Collection and Map by using isEmpty() instead of c.size() == 0). It's more clear and as efficient. Removes also useless parentheses there.

Makes use of UtilValidate.is(Not)Empty() everywhere it makes senses. This for 2 reasons:
* Make the code more readable by replacing the (!)null/isEmpty pattern.
* Avoid possible NPEs when only isEmpty() was used (after Entity.find... for instance). I found a lot of cases (242 today) where isEmpty() could perhaps be replaced in Framework. But I guess no NPE checks were missing there and anyway it was too much for me to check them all... So I only did the relevant changes in Applications...


Modified:
    ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java
    ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
    ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java
    ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryWorker.java
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilValidate.java
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/FlexibleMapAccessor.java
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java
    ofbiz/trunk/framework/birt/src/org/ofbiz/birt/report/service/OFBizBirtViewerReportService.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java
    ofbiz/trunk/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLInsert.java
    ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/seleniumxml/RemoteRequest.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java
    ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java
    ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Journal.java
    ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WfApplicationServices.java

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java?rev=1169478&r1=1169477&r2=1169478&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java Sun Sep 11 17:06:11 2011
@@ -91,7 +91,7 @@ public class ContentServices {
             return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentAssocRetrievingError", UtilMisc.toMap("errorString", e.toString()), locale));
         }
 
-        if (targetOperations == null || targetOperations.isEmpty()) {
+        if (UtilValidate.isEmpty(targetOperations)) {
             results.put("contentList", contentList);
             return results;
         }

Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java?rev=1169478&r1=1169477&r2=1169478&view=diff
==============================================================================
--- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java (original)
+++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java Sun Sep 11 17:06:11 2011
@@ -3063,7 +3063,7 @@ public class ProductionRunServices {
                                  "userLogin", userLogin);
             resultService = dispatcher.runSync("getManufacturingComponents", serviceContext);
             List<Map<String, Object>> components = UtilGenerics.checkList(resultService.get("componentsMap"));
-            if (components == null || components.isEmpty()) {
+            if (UtilValidate.isEmpty(components)) {
                 return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunCannotDecomposingInventoryItemNoComponentsFound", UtilMisc.toMap("productId", inventoryItem.getString("productId")), locale));
             }
             Iterator<Map<String, Object>> componentsIt = components.iterator();

Modified: ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java?rev=1169478&r1=1169477&r2=1169478&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java (original)
+++ ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java Sun Sep 11 17:06:11 2011
@@ -122,7 +122,7 @@ public class VCard {
                                                         EntityCondition.makeCondition("geoTypeId", EntityOperator.EQUALS, "COUNTRY"),
                                                         EntityCondition.makeCondition("geoName", EntityOperator.LIKE, workAddress.getCountry())), EntityOperator.AND);
                     countryGeoList = delegator.findList("Geo", cond, null, null, null, true);
-                    if (!countryGeoList.isEmpty()) {
+                    if (UtilValidate.isNotEmpty(countryGeoList)) {
                         GenericValue countryGeo = EntityUtil.getFirst(countryGeoList);
                         serviceCtx.put("countryGeoId", countryGeo.get("geoId"));
                     }
@@ -131,7 +131,7 @@ public class VCard {
                             EntityCondition.makeCondition("geoTypeId", EntityOperator.EQUALS, "STATE"),
                             EntityCondition.makeCondition("geoName", EntityOperator.LIKE, workAddress.getRegion())), EntityOperator.AND);
                     stateGeoList = delegator.findList("Geo", condition, null, null, null, true);
-                    if (!stateGeoList.isEmpty()) {
+                    if (UtilValidate.isNotEmpty(stateGeoList)) {
                         GenericValue stateGeo = EntityUtil.getFirst(stateGeoList);
                         serviceCtx.put("stateProvinceGeoId", stateGeo.get("geoId"));
                     }

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=1169478&r1=1169477&r2=1169478&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 Sun Sep 11 17:06:11 2011
@@ -2537,7 +2537,7 @@ public class OrderReadHelper {
 
         List<GenericValue> promoAdjustments = EntityUtil.filterByAnd(allOrderAdjustments, UtilMisc.toMap("orderAdjustmentTypeId", "PROMOTION_ADJUSTMENT"));
 
-        if (!promoAdjustments.isEmpty()) {
+        if (UtilValidate.isNotEmpty(promoAdjustments)) {
 
             Iterator<GenericValue> promoAdjIter = promoAdjustments.iterator();
             while (promoAdjIter.hasNext()) {

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=1169478&r1=1169477&r2=1169478&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Sun Sep 11 17:06:11 2011
@@ -2791,7 +2791,7 @@ public class ShoppingCart implements Ite
         GenericValue orderTerm = this.getDelegator().makeValue("OrderTerm");
         orderTerm.put("termTypeId", termTypeId);
         if (UtilValidate.isEmpty(orderItemSeqId)) {
-         orderItemSeqId = "_NA_";
+                orderItemSeqId = "_NA_";
         }
         orderTerm.put("orderItemSeqId", orderItemSeqId);
         orderTerm.put("termValue", termValue);

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java?rev=1169478&r1=1169477&r2=1169478&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Sun Sep 11 17:06:11 2011
@@ -633,7 +633,7 @@ public class ShoppingCartServices {
 
         List<GenericValue> adjustments = orh.getOrderHeaderAdjustments();
         // If applyQuoteAdjustments is set to false then standard cart adjustments are used.
-        if (!adjustments.isEmpty()) {
+        if (UtilValidate.isNotEmpty(adjustments)) {
             // The cart adjustments are added to the cart
             cart.getAdjustments().addAll(adjustments);
         }

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java?rev=1169478&r1=1169477&r2=1169478&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java Sun Sep 11 17:06:11 2011
@@ -377,7 +377,7 @@ public class ShoppingListEvents {
             List<GenericValue> existingLists = delegator.findByAnd("ShoppingList", findMap);
             Debug.logInfo("Finding existing auto-save shopping list with:  \nfindMap: " + findMap + "\nlists: " + existingLists, module);
     
-            if (existingLists != null && !existingLists.isEmpty()) {
+            if (UtilValidate.isNotEmpty(existingLists)) {
                 list = EntityUtil.getFirst(existingLists);
                 autoSaveListId = list.getString("shoppingListId");
             }

Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java?rev=1169478&r1=1169477&r2=1169478&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java (original)
+++ ofbiz/trunk/applications/party/src/org/ofbiz/party/communication/CommunicationEventServices.java Sun Sep 11 17:06:11 2011
@@ -744,7 +744,7 @@ public class CommunicationEventServices
                 Debug.logError(e, module);
                 return ServiceUtil.returnError(e.getMessage());
             }
-            if (!commEvents.isEmpty()) {
+            if (UtilValidate.isNotEmpty(commEvents)) {
                 Debug.logInfo("Ignoring Duplicate Email: " + aboutThisEmail, module);
                 return ServiceUtil.returnSuccess(UtilProperties.getMessage(resource,
                         "PartyCommEventMessageIgnoredDuplicateMessageId", locale));
@@ -756,7 +756,7 @@ public class CommunicationEventServices
             List<Map<String, Object>> bccParties = buildListOfPartyInfoFromEmailAddresses(addressesBCC, userLogin, dispatcher);
 
             //Get the first address from the list - this is the partyIdTo field of the CommunicationEvent
-            if (!toParties.isEmpty()) {
+            if (UtilValidate.isNotEmpty(toParties)) {
                 Iterator<Map<String, Object>> itr = toParties.iterator();
                 Map<String, Object> firstAddressTo = itr.next();
                 partyIdTo = (String)firstAddressTo.get("partyId");

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java?rev=1169478&r1=1169477&r2=1169478&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/category/CategoryServices.java Sun Sep 11 17:06:11 2011
@@ -123,7 +123,7 @@ public class CategoryServices {
             EntityCondition condition = EntityCondition.makeCondition(EntityCondition.makeCondition("releaseDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("releaseDate", EntityOperator.LESS_THAN_EQUAL_TO, releaseDateLimit));
             filterConditions.add(condition);
         }
-        if (!filterConditions.isEmpty()) {
+        if (UtilValidate.isNotEmpty(filterConditions)) {
             productCategoryMembers = EntityUtil.filterByCondition(productCategoryMembers, EntityCondition.makeCondition(filterConditions, EntityOperator.AND));
         }
 
@@ -290,7 +290,7 @@ public class CategoryServices {
                         EntityCondition condition = EntityCondition.makeCondition(EntityCondition.makeCondition("releaseDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("releaseDate", EntityOperator.LESS_THAN_EQUAL_TO, releaseDateLimit));
                         filterConditions.add(condition);
                     }
-                    if (!filterConditions.isEmpty()) {
+                    if (UtilValidate.isNotEmpty(filterConditions)) {
                         productCategoryMembers = EntityUtil.filterByCondition(productCategoryMembers, EntityCondition.makeCondition(filterConditions, EntityOperator.AND));
                     }
 

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=1169478&r1=1169477&r2=1169478&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 Sun Sep 11 17:06:11 2011
@@ -87,8 +87,7 @@ public class CategoryWorker {
             for (GenericValue curCat: allCategories) {
                 Collection<GenericValue> parentCats = curCat.getRelatedCache("CurrentProductCategoryRollup");
 
-                if (parentCats.isEmpty())
-                    results.add(curCat);
+                if (parentCats.isEmpty()) results.add(curCat);
             }
         } catch (GenericEntityException e) {
             Debug.logWarning(e, module);
@@ -116,8 +115,7 @@ public class CategoryWorker {
     public static void getRelatedCategories(ServletRequest request, String attributeName, String parentId, boolean limitView, boolean excludeEmpty) {
         List<GenericValue> categories = getRelatedCategoriesRet(request, attributeName, parentId, limitView, excludeEmpty);
 
-        if (!categories.isEmpty())
-            request.setAttribute(attributeName, categories);
+        if (!categories.isEmpty())  request.setAttribute(attributeName, categories);
     }
 
     public static List<GenericValue> getRelatedCategoriesRet(ServletRequest request, String attributeName, String parentId, boolean limitView) {

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilValidate.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilValidate.java?rev=1169478&r1=1169477&r2=1169478&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilValidate.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilValidate.java Sun Sep 11 17:06:11 2011
@@ -206,32 +206,32 @@ public class UtilValidate {
 
     /** Check whether string s is empty. */
     public static boolean isEmpty(String s) {
-        return ((s == null) || (s.length() == 0));
+        return (s == null) || s.length() == 0;
     }
 
     /** Check whether collection c is empty. */
     public static <E> boolean isEmpty(Collection<E> c) {
-        return ((c == null) || (c.size() == 0));
+        return (c == null) || c.isEmpty();
     }
 
     /** Check whether map m is empty. */
     public static <K,E> boolean isEmpty(Map<K,E> m) {
-        return ((m == null) || (m.size() == 0));
+        return (m == null) || m.isEmpty();
     }
 
     /** Check whether charsequence c is empty. */
     public static <E> boolean isEmpty(CharSequence c) {
-        return ((c == null) || (c.length() == 0));
+        return (c == null) || (c.length() == 0);
     }
 
     /** Check whether string s is NOT empty. */
     public static boolean isNotEmpty(String s) {
-        return ((s != null) && (s.length() > 0));
+        return (s != null) && (s.length() > 0);
     }
 
     /** Check whether collection c is NOT empty. */
     public static <E> boolean isNotEmpty(Collection<E> c) {
-        return ((c != null) && (c.size() > 0));
+        return (c != null) && !c.isEmpty();
     }
 
     /** Check whether charsequence c is NOT empty. */

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=1169478&r1=1169477&r2=1169478&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 Sun Sep 11 17:06:11 2011
@@ -121,7 +121,7 @@ public class FlexibleMapAccessor<T> impl
      * @return the found value
      */
     public T get(Map<String, ? extends Object> base, Locale locale) {
-        if (base == null || this.isEmpty()) {
+        if (UtilValidate.isEmpty(base)) {
             return null;
         }
         if (!base.containsKey(UelUtil.localizedMapLocaleKey) && locale != null) {

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java?rev=1169478&r1=1169477&r2=1169478&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java Sun Sep 11 17:06:11 2011
@@ -108,7 +108,7 @@ public class FreeMarkerWorker {
             URL propertyURL = resources.nextElement();
             Debug.logInfo("loading properties: " + propertyURL, module);
             Properties props = UtilProperties.getProperties(propertyURL);
-            if (props == null || props.isEmpty()) {
+            if (UtilValidate.isEmpty(props)) {
                 Debug.logError("Unable to locate properties file " + propertyURL, module);
             } else {
                 loadTransforms(loader, props, newConfig);

Modified: ofbiz/trunk/framework/birt/src/org/ofbiz/birt/report/service/OFBizBirtViewerReportService.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/birt/src/org/ofbiz/birt/report/service/OFBizBirtViewerReportService.java?rev=1169478&r1=1169477&r2=1169478&view=diff
==============================================================================
--- ofbiz/trunk/framework/birt/src/org/ofbiz/birt/report/service/OFBizBirtViewerReportService.java (original)
+++ ofbiz/trunk/framework/birt/src/org/ofbiz/birt/report/service/OFBizBirtViewerReportService.java Sun Sep 11 17:06:11 2011
@@ -48,6 +48,7 @@ import org.eclipse.birt.report.utility.D
 import org.eclipse.birt.report.utility.ParameterAccessor;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilGenerics;
+import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.birt.container.BirtContainer;
 
 @SuppressWarnings("deprecation")
@@ -106,7 +107,7 @@ public class OFBizBirtViewerReportServic
                 Debug.logError(e, module);
             }
             List<Exception> errors = this.runReport(request, runnable, outputDocName, locale, timeZone, parsedParams, displayTextMap, maxRows);
-            if (errors != null && !errors.isEmpty()) {
+            if (UtilValidate.isNotEmpty(errors)) {
                 errorList.addAll(errors);
             }
         } catch ( RemoteException e ) {

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java?rev=1169478&r1=1169477&r2=1169478&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java Sun Sep 11 17:06:11 2011
@@ -814,11 +814,11 @@ public class GenericDAO {
         }
 
         List<EntityCondition> conditions = FastList.newInstance();
-        if (whereEntityCondition != null && !whereEntityCondition.isEmpty()) {
+        if (UtilValidate.isNotEmpty(whereEntityCondition)) {
             conditions.add(whereEntityCondition);
         }
 
-        if (modelViewEntity != null && !viewWhereConditions.isEmpty()) {
+        if (UtilValidate.isNotEmpty(modelViewEntity)) {
             EntityCondition viewWhereEntityCondition = EntityCondition.makeCondition(viewWhereConditions);
             if (!viewWhereEntityCondition.isEmpty()) {
                 conditions.add(viewWhereEntityCondition);

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java?rev=1169478&r1=1169477&r2=1169478&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java Sun Sep 11 17:06:11 2011
@@ -154,7 +154,7 @@ public class TransactionUtil implements
 
                     RollbackOnlyCause roc = getSetRollbackOnlyCause();
                     // do we have a cause? if so, throw special exception
-                    if (roc != null && !roc.isEmpty()) {
+                    if (UtilValidate.isNotEmpty(roc)) {
                         throw new GenericTransactionException("The current transaction is marked for rollback, not beginning a new transaction and aborting current operation; the rollbackOnly was caused by: " + roc.getCauseMessage(), roc.getCauseThrowable());
                     } else {
                         return false;

Modified: ofbiz/trunk/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java?rev=1169478&r1=1169477&r2=1169478&view=diff
==============================================================================
--- ofbiz/trunk/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java (original)
+++ ofbiz/trunk/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java Sun Sep 11 17:06:11 2011
@@ -42,6 +42,7 @@ import org.ofbiz.base.container.Containe
 import org.ofbiz.base.container.ContainerException;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.SSLUtil;
+import org.ofbiz.base.util.UtilValidate;
 
 
 /**
@@ -116,12 +117,12 @@ public class JettyContainer implements C
                         context.setSessionHandler(new SessionHandler(sm));
 
                         // set the virtual hosts
-                        if (virtualHosts != null && !virtualHosts.isEmpty()) {
+                        if (UtilValidate.isNotEmpty(virtualHosts)) {
                             context.setVirtualHosts((String[]) virtualHosts.toArray());
                         }
 
                         // set the init parameters
-                        if (initParameters != null && !initParameters.isEmpty()) {
+                        if (UtilValidate.isNotEmpty(initParameters)) {
                             context.setInitParams(initParameters);
                         }
 

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLInsert.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLInsert.java?rev=1169478&r1=1169477&r2=1169478&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLInsert.java (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/SQLInsert.java Sun Sep 11 17:06:11 2011
@@ -22,6 +22,7 @@ import java.util.Iterator;
 import java.util.List;
 
 import org.ofbiz.base.util.StringUtil;
+import org.ofbiz.base.util.UtilValidate;
 
 public final class SQLInsert extends SQLStatement<SQLInsert> {
     private final TableName tableName;
@@ -64,7 +65,7 @@ public final class SQLInsert extends SQL
     public StringBuilder appendTo(StringBuilder sb) {
         sb.append("INSERT INTO ");
         tableName.appendTo(sb);
-        if (columns != null && !columns.isEmpty()) {
+        if (UtilValidate.isNotEmpty(columns)) {
             sb.append(" (");
             StringUtil.append(sb, columns, null, null, ", ");
             sb.append(')');

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=1169478&r1=1169477&r2=1169478&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 Sun Sep 11 17:06:11 2011
@@ -58,6 +58,8 @@ import org.apache.http.params.HttpProtoc
 import org.apache.http.protocol.BasicHttpContext;
 import org.jdom.Element;
 
+import org.ofbiz.base.util.UtilValidate;
+
 
 public class RemoteRequest {
 
@@ -114,7 +116,7 @@ public class RemoteRequest {
     public RemoteRequest(SeleniumXml parent, List<Element> children, List<Element> loginAs, String requestUrl, String hostString, String responseHandlerMode) {
 
         this(parent, children, requestUrl, hostString, responseHandlerMode);
-        if(loginAs != null && !loginAs.isEmpty()) {
+        if (UtilValidate.isNotEmpty(loginAs)) {
             Element elem = loginAs.get(0);
 
             this.loginAsUserParam = elem.getAttributeValue("username-param");

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=1169478&r1=1169477&r2=1169478&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Sun Sep 11 17:06:11 2011
@@ -2492,7 +2492,7 @@ public class ModelForm extends ModelWidg
     }
 
     public boolean getPaginate(Map<String, Object> context) {
-        if (this.paginate != null && !this.paginate.isEmpty() && UtilValidate.isNotEmpty(this.paginate.expandString(context))) {
+        if (UtilValidate.isNotEmpty(this.paginate) && UtilValidate.isNotEmpty(this.paginate.expandString(context))) {
             return Boolean.valueOf(this.paginate.expandString(context)).booleanValue();
         } else {
             return true;

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=1169478&r1=1169477&r2=1169478&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Sun Sep 11 17:06:11 2011
@@ -266,7 +266,7 @@ public class ModelFormField {
         // incorporate updates for values that are not empty in the overrideFormField
         if (UtilValidate.isNotEmpty(overrideFormField.name))
             this.name = overrideFormField.name;
-        if (overrideFormField.mapAcsr != null && !overrideFormField.mapAcsr.isEmpty()) {
+        if (UtilValidate.isNotEmpty(overrideFormField.mapAcsr)) {
             //Debug.logInfo("overriding mapAcsr, old=" + (this.mapAcsr==null?"null":this.mapAcsr.getOriginalName()) + ", new=" + overrideFormField.mapAcsr.getOriginalName(), module);
             this.mapAcsr = overrideFormField.mapAcsr;
         }
@@ -274,7 +274,7 @@ public class ModelFormField {
             this.entityName = overrideFormField.entityName;
         if (UtilValidate.isNotEmpty(overrideFormField.serviceName))
             this.serviceName = overrideFormField.serviceName;
-        if (overrideFormField.entryAcsr != null && !overrideFormField.entryAcsr.isEmpty())
+        if (UtilValidate.isNotEmpty(overrideFormField.entryAcsr))
             this.entryAcsr = overrideFormField.entryAcsr;
         if (UtilValidate.isNotEmpty(overrideFormField.parameterName))
             this.parameterName = overrideFormField.parameterName;
@@ -282,9 +282,9 @@ public class ModelFormField {
             this.fieldName = overrideFormField.fieldName;
         if (UtilValidate.isNotEmpty(overrideFormField.attributeName))
             this.attributeName = overrideFormField.attributeName;
-        if (overrideFormField.title != null && !overrideFormField.title.isEmpty()) // title="" can be used to override the original value
+        if (UtilValidate.isNotEmpty(overrideFormField.title)) // title="" can be used to override the original value
             this.title = overrideFormField.title;
-        if (overrideFormField.tooltip != null && !overrideFormField.tooltip.isEmpty())
+        if (UtilValidate.isNotEmpty(overrideFormField.tooltip))
             this.tooltip = overrideFormField.tooltip;
         if (overrideFormField.requiredField != null)
             this.requiredField = overrideFormField.requiredField;
@@ -304,9 +304,9 @@ public class ModelFormField {
             this.redWhen = overrideFormField.redWhen;
         if (UtilValidate.isNotEmpty(overrideFormField.event))
             this.event = overrideFormField.event;
-        if (overrideFormField.action != null && !overrideFormField.action.isEmpty())
+        if (UtilValidate.isNotEmpty(overrideFormField.action))
             this.action = overrideFormField.action;
-        if (overrideFormField.useWhen != null && !overrideFormField.useWhen.isEmpty())
+        if (UtilValidate.isNotEmpty(overrideFormField.useWhen))
             this.useWhen = overrideFormField.useWhen;
         if (overrideFormField.fieldInfo != null) {
             this.setFieldInfo(overrideFormField.fieldInfo);
@@ -654,7 +654,7 @@ public class ModelFormField {
     }
 
     public String getEntryName() {
-        if (this.entryAcsr != null && !this.entryAcsr.isEmpty()) {
+        if (UtilValidate.isNotEmpty(this.entryAcsr)) {
             return this.entryAcsr.getOriginalName();
         } else {
             return this.name;
@@ -713,7 +713,7 @@ public class ModelFormField {
                 dataMapIsContext = true;
             }
             Object retVal = null;
-            if (this.entryAcsr != null && !this.entryAcsr.isEmpty()) {
+            if (UtilValidate.isNotEmpty(this.entryAcsr)) {
                 //Debug.logInfo("Getting entry, using entryAcsr for field " + this.getName() + " of form " + this.modelForm.getName(), module);
                 if (dataMap instanceof GenericEntity) {
                     GenericEntity genEnt = (GenericEntity) dataMap;
@@ -735,7 +735,7 @@ public class ModelFormField {
             if (dataMapIsContext && retVal == null && !Boolean.FALSE.equals(useRequestParameters)) {
                 Map<String, ? extends Object> parameters = UtilGenerics.checkMap(context.get("parameters"));
                 if (parameters != null) {
-                    if (this.entryAcsr != null && !this.entryAcsr.isEmpty()) {
+                    if (UtilValidate.isNotEmpty(this.entryAcsr)) {
                         retVal = this.entryAcsr.get(parameters);
                     } else {
                         retVal = parameters.get(this.name);
@@ -779,7 +779,7 @@ public class ModelFormField {
     }
 
     public Map<String, ? extends Object> getMap(Map<String, ? extends Object> context) {
-        if (this.mapAcsr == null || this.mapAcsr.isEmpty()) {
+        if (UtilValidate.isEmpty(this.mapAcsr)) {
             //Debug.logInfo("Getting Map from default of the form because of no mapAcsr for field " + this.getName(), module);
             return this.modelForm.getDefaultMap(context);
         } else {
@@ -820,7 +820,7 @@ public class ModelFormField {
      * @return returns the name of the Map in the form context that contains the entry
      */
     public String getMapName() {
-        if (this.mapAcsr != null && !this.mapAcsr.isEmpty()) {
+        if (UtilValidate.isNotEmpty(this.mapAcsr)) {
             return this.mapAcsr.getOriginalName();
         } else {
             return this.modelForm.getDefaultMapName();
@@ -871,7 +871,7 @@ public class ModelFormField {
     }
 
     public String getAction(Map<String, ? extends Object> context) {
-        if (this.action != null && !this.action.isEmpty()) {
+        if (UtilValidate.isNotEmpty(this.action)) {
             return action.expandString(context);
         } else {
             return null;
@@ -1002,7 +1002,7 @@ public class ModelFormField {
     }
 
     public String getTitle(Map<String, Object> context) {
-        if (this.title != null && !this.title.isEmpty()) {
+        if (UtilValidate.isNotEmpty(this.title)) {
             return title.expandString(context);
         } else {
             // create a title from the name of this field; expecting a Java method/field style name, ie productName or productCategoryId
@@ -1088,7 +1088,7 @@ public class ModelFormField {
     }
 
     public String getTooltip(Map<String, Object> context) {
-        if (tooltip != null && !tooltip.isEmpty()) {
+        if (UtilValidate.isNotEmpty(tooltip)) {
             return tooltip.expandString(context);
         } else {
             return "";
@@ -1096,7 +1096,7 @@ public class ModelFormField {
     }
 
     public String getUseWhen(Map<String, Object> context) {
-        if (this.useWhen != null && !this.useWhen.isEmpty()) {
+        if (UtilValidate.isNotEmpty(this.useWhen)) {
             return this.useWhen.expandString(context);
         } else {
             return "";
@@ -2127,7 +2127,7 @@ public class ModelFormField {
 
         public String getDescription(Map<String, Object> context) {
             String retVal = null;
-            if (this.description != null && !this.description.isEmpty()) {
+            if (UtilValidate.isNotEmpty(this.description)) {
                 retVal = this.description.expandString(context);
             } else {
                 retVal = this.modelFormField.getEntry(context);
@@ -2139,7 +2139,7 @@ public class ModelFormField {
                 Locale locale = (Locale) context.get("locale");
                 if (locale == null) locale = Locale.getDefault();
                 String isoCode = null;
-                if (this.currency != null && !this.currency.isEmpty()) {
+                if (UtilValidate.isNotEmpty(this.currency)) {
                     isoCode = this.currency.expandString(context);
                 }
 
@@ -2308,7 +2308,7 @@ public class ModelFormField {
             this.cache = !"false".equals(element.getAttribute("cache"));
             this.size = element.getAttribute("size");
 
-            if (this.description == null || this.description.isEmpty()) {
+            if (UtilValidate.isEmpty(this.description)) {
                 this.setDescription("${description}");
             }
 
@@ -3201,7 +3201,7 @@ public class ModelFormField {
          * @return Default value string for date-time
          */
         public String getDefaultDateTimeString(Map<String, Object> context) {
-            if (this.defaultValue != null && !this.defaultValue.isEmpty()) {
+            if (UtilValidate.isNotEmpty(this.defaultValue)) {
                 return this.getDefaultValue(context);
             }
 
@@ -3566,7 +3566,7 @@ public class ModelFormField {
         }
 
         public String getValue(Map<String, Object> context) {
-            if (this.value != null && !this.value.isEmpty()) {
+            if (UtilValidate.isNotEmpty(this.value)) {
                 String valueEnc = this.value.expandString(context);
                 StringUtil.SimpleEncoder simpleEncoder = (StringUtil.SimpleEncoder) context.get("simpleEncoder");
                 if (simpleEncoder != null) {
@@ -3961,7 +3961,7 @@ public class ModelFormField {
         }
 
         public String getValue(Map<String, Object> context) {
-            if (this.value != null && !this.value.isEmpty()) {
+            if (UtilValidate.isNotEmpty(this.value)) {
                 return this.value.expandString(context);
             } else {
                 return modelFormField.getEntry(context);
@@ -3973,7 +3973,7 @@ public class ModelFormField {
         }
 
         public String getDescription(Map<String, Object> context) {
-            if (this.description != null && !this.description.isEmpty()) {
+            if (UtilValidate.isNotEmpty(this.description)) {
                 return this.description.expandString(context);
             } else {
                 return "";
@@ -3985,7 +3985,7 @@ public class ModelFormField {
         }
 
         public String getAlternate(Map<String, Object> context) {
-            if (this.alternate != null && !this.alternate.isEmpty()) {
+            if (UtilValidate.isNotEmpty(this.alternate)) {
                 return this.alternate.expandString(context);
             } else {
                 return "";

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java?rev=1169478&r1=1169477&r2=1169478&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java Sun Sep 11 17:06:11 2011
@@ -240,9 +240,9 @@ public class ModelMenuItem {
             this.entityName = overrideMenuItem.entityName;
         if (UtilValidate.isNotEmpty(overrideMenuItem.parentPortalPageId))
             this.parentPortalPageId = overrideMenuItem.parentPortalPageId;
-        if (overrideMenuItem.title != null && !overrideMenuItem.title.isEmpty())
+        if (UtilValidate.isNotEmpty(overrideMenuItem.title))
             this.title = overrideMenuItem.title;
-        if (overrideMenuItem.tooltip != null && !overrideMenuItem.tooltip.isEmpty())
+        if (UtilValidate.isNotEmpty(overrideMenuItem.tooltip))
             this.tooltip = overrideMenuItem.tooltip;
         if (UtilValidate.isNotEmpty(overrideMenuItem.titleStyle))
             this.titleStyle = overrideMenuItem.titleStyle;
@@ -388,7 +388,7 @@ public class ModelMenuItem {
     }
 
     public String getTooltip(Map<String, Object> context) {
-        if (tooltip != null && !tooltip.isEmpty()) {
+        if (UtilValidate.isNotEmpty(tooltip)) {
             return tooltip.expandString(context);
         } else {
             return "";

Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java?rev=1169478&r1=1169477&r2=1169478&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java (original)
+++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java Sun Sep 11 17:06:11 2011
@@ -1188,7 +1188,7 @@ public class PosTransaction implements S
     public void loadSale(PosScreen pos) {
         trace("Load a sale");
         List<GenericValue> shoppingLists = createShoppingLists();
-        if (!shoppingLists.isEmpty()) {
+        if (UtilValidate.isNotEmpty(shoppingLists)) {
             Map<String, String> salesMap = createSalesMap(shoppingLists);
             if (!salesMap.isEmpty()) {
                 LoadSale loadSale = new LoadSale(salesMap, this, pos);
@@ -1204,7 +1204,7 @@ public class PosTransaction implements S
 
     public void loadOrder(PosScreen pos) {
         List<GenericValue> orders = findOrders();
-        if (!orders.isEmpty()) {
+        if (UtilValidate.isNotEmpty(orders)) {
             LoadSale loadSale = new LoadSale(createOrderHash(orders), this, pos);
             loadSale.openDlg();
         } else {

Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Journal.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Journal.java?rev=1169478&r1=1169477&r2=1169478&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Journal.java (original)
+++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Journal.java Sun Sep 11 17:06:11 2011
@@ -32,6 +32,7 @@ import net.xoetrope.xui.style.XStyle;
 
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilProperties;
+import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.pos.PosTransaction;
 import org.ofbiz.pos.screen.PosScreen;
 
@@ -135,7 +136,7 @@ public class Journal {
 
         PosTransaction tx = PosTransaction.getCurrentTx(pos.getSession());
         XModel jmodel = this.createModel();
-        if (tx != null && !tx.isEmpty()) {
+        if (UtilValidate.isNotEmpty(tx)) {
             tx.appendItemDataModel(jmodel);
             this.appendEmpty(jmodel);
             tx.appendTotalDataModel(jmodel);

Modified: ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WfApplicationServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WfApplicationServices.java?rev=1169478&r1=1169477&r2=1169478&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WfApplicationServices.java (original)
+++ ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/WfApplicationServices.java Sun Sep 11 17:06:11 2011
@@ -32,6 +32,7 @@ import org.ofbiz.base.util.GeneralExcept
 import org.ofbiz.base.util.ObjectType;
 import org.ofbiz.base.util.UtilGenerics;
 import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
@@ -310,7 +311,7 @@ public class WfApplicationServices {
 
         try {
             final List<GenericValue> assigments = delegator.findByAnd("WorkEffortPartyAssignment", expresions, orderBy);
-            if (assigments.isEmpty()) {
+            if (UtilValidate.isEmpty(assigments)) {
                 Debug.logError("No accepted activities found for the workEffortId=" + workEffortId, module);
                 throw new GenericServiceException("Can not find WorkEffortPartyAssignment for the Workflow service. WorkEffortId=" + workEffortId);
             }