svn commit: r883516 - in /ofbiz/trunk: applications/content/src/org/ofbiz/content/webapp/ftl/ applications/product/src/org/ofbiz/shipment/shipment/ framework/base/src/org/ofbiz/base/util/ framework/datafile/src/org/ofbiz/datafile/ framework/entity/src/...

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

svn commit: r883516 - in /ofbiz/trunk: applications/content/src/org/ofbiz/content/webapp/ftl/ applications/product/src/org/ofbiz/shipment/shipment/ framework/base/src/org/ofbiz/base/util/ framework/datafile/src/org/ofbiz/datafile/ framework/entity/src/...

jleroux@apache.org
Author: jleroux
Date: Mon Nov 23 22:02:05 2009
New Revision: 883516

URL: http://svn.apache.org/viewvc?rev=883516&view=rev
Log:
Use UtilValidate.isEmpty methods instead of (obj == null) || (obj.size == 0)
Complete r883492

Modified:
    ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/MessageString.java
    ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractEntityConditionCache.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java
    ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java?rev=883516&r1=883515&r2=883516&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java Mon Nov 23 22:02:05 2009
@@ -102,7 +102,7 @@
                 //GenericValue currentValue = getCurrentContent(delegator, trail,  userLogin, templateCtx, nullThruDatesOnly, contentAssocPredicateId);
                 String redo = (String)templateCtx.get("redo");
 
-                if (trail == null || trail.size() == 0 || (redo != null && redo.equalsIgnoreCase("true"))) {
+                if (UtilValidate.isEmpty(trail) || (redo != null && redo.equalsIgnoreCase("true"))) {
                     String thisContentId = null;
                     String subContentId = (String)templateCtx.get("subContentId");
                     if (Debug.infoOn()) Debug.logInfo("in InjectNodeTrailCsv(0), subContentId:"+subContentId,module);

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java?rev=883516&r1=883515&r2=883516&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/shipment/ShipmentServices.java Mon Nov 23 22:02:05 2009
@@ -300,7 +300,7 @@
             }
             List<GenericValue> toGeoList = GeoWorker.expandGeoGroup(toGeo, delegator);
             // Make sure we have a valid GEOID.
-            if (toGeoList == null || toGeoList.size() == 0 ||
+            if (UtilValidate.isEmpty(toGeoList) ||
                     GeoWorker.containsGeo(toGeoList, shipAddress.getString("countryGeoId"), delegator) ||
                     GeoWorker.containsGeo(toGeoList, shipAddress.getString("stateProvinceGeoId"), delegator) ||
                     GeoWorker.containsGeo(toGeoList, shipAddress.getString("postalCodeGeoId"), delegator)) {

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/MessageString.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/MessageString.java?rev=883516&r1=883515&r2=883516&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/MessageString.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/MessageString.java Mon Nov 23 22:02:05 2009
@@ -61,7 +61,7 @@
         return getMessagesForField(fieldSet, convertToStrings, messageStringList);
     }
     public static List<Object> getMessagesForField(Set<String> fieldNameSet, boolean convertToStrings, List<Object> messageStringList) {
-        if (messageStringList == null || fieldNameSet == null || fieldNameSet.size() == 0) {
+        if (messageStringList == null || UtilValidate.isEmpty(fieldNameSet)) {
             return Collections.emptyList();
         }
         List<Object> outList = new ArrayList<Object>(messageStringList.size());

Modified: ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java?rev=883516&r1=883515&r2=883516&view=diff
==============================================================================
--- ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java (original)
+++ ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java Mon Nov 23 22:02:05 2009
@@ -30,6 +30,7 @@
 
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilTimer;
+import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.UtilXml;
 import org.ofbiz.base.util.cache.UtilCache;
 import org.w3c.dom.Document;
@@ -67,7 +68,7 @@
                 }
             }
         }
-        if (reader != null && (reader.modelDataFiles == null || reader.modelDataFiles.size() == 0)) {
+        if (reader != null && UtilValidate.isEmpty(reader.modelDataFiles)) {
             readers.remove(readerURL);
             return null;
         }

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractEntityConditionCache.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractEntityConditionCache.java?rev=883516&r1=883515&r2=883516&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractEntityConditionCache.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractEntityConditionCache.java Mon Nov 23 22:02:05 2009
@@ -26,6 +26,7 @@
 
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.cache.UtilCache;
 import org.ofbiz.entity.GenericEntity;
 import org.ofbiz.entity.GenericPK;
@@ -175,7 +176,7 @@
     protected <T1 extends Map<String, Object>, T2 extends Map<String, Object>> void storeHook(String entityName, boolean isPK, List<T1> oldValues, List<T2> newValues) {
         UtilCache<EntityCondition, Map<K, V>> entityCache = UtilCache.findCache(getCacheName(entityName));
         // for info about cache clearing
-        if (newValues == null || newValues.size() == 0 || newValues.get(0) == null) {
+        if (UtilValidate.isEmpty(newValues) || newValues.get(0) == null) {
             //Debug.logInfo("In storeHook (cache clear) for entity name [" + entityName + "], got entity cache with name: " + (entityCache == null ? "[No cache found to remove from]" : entityCache.getName()), module);
         }
         if (entityCache == null) {

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java?rev=883516&r1=883515&r2=883516&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java Mon Nov 23 22:02:05 2009
@@ -2190,7 +2190,7 @@
     }
 
     public void repairColumnSizeChanges(Map<String, ModelEntity> modelEntities, List<String> fieldsWrongSize, List<String> messages) {
-        if (modelEntities == null || fieldsWrongSize == null || fieldsWrongSize.size() == 0) {
+        if (modelEntities == null || UtilValidate.isEmpty(fieldsWrongSize)) {
             messages.add("No fields to repair");
             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=883516&r1=883515&r2=883516&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java (original)
+++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/PosTransaction.java Mon Nov 23 22:02:05 2009
@@ -220,7 +220,7 @@
     }
 
     public boolean isEmpty() {
-        return (cart == null || cart.size() == 0);
+        return (UtilValidate.isEmpty(cart));
     }
 
     public List<GenericValue> lookupItem(String sku) throws GeneralException {