diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/cache/AbstractEntityConditionCache.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/cache/AbstractEntityConditionCache.java index a64a81792c..af296ba79b 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/cache/AbstractEntityConditionCache.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/cache/AbstractEntityConditionCache.java @@ -26,7 +26,6 @@ import java.util.concurrent.ConcurrentMap; import org.apache.ofbiz.base.util.Debug; import org.apache.ofbiz.base.util.UtilMisc; -import org.apache.ofbiz.base.util.UtilValidate; import org.apache.ofbiz.base.util.cache.UtilCache; import org.apache.ofbiz.entity.GenericEntity; import org.apache.ofbiz.entity.GenericPK; @@ -44,7 +43,9 @@ public abstract class AbstractEntityConditionCache extends AbstractCache conditionCache = getConditionCache(entityName, condition); - if (conditionCache == null) return null; + if (conditionCache == null) { + return null; + } return conditionCache.get(key); } @@ -74,13 +75,17 @@ public abstract class AbstractEntityConditionCache extends AbstractCache> cache = getCache(entityName); - if (cache == null) return; + if (cache == null) { + return; + } cache.remove(condition); } protected V remove(String entityName, EntityCondition condition, K key) { ConcurrentMap conditionCache = getConditionCache(entityName, condition); - if (conditionCache == null) return null; + if (conditionCache == null) { + return null; + } return conditionCache.remove(key); } @@ -90,19 +95,14 @@ public abstract class AbstractEntityConditionCache extends AbstractCache extends AbstractCache newValueIter = newValues.iterator(); while (newValueIter.hasNext() && !shouldRemove) { T2 newValue = newValueIter.next(); shouldRemove |= isNull(newValue) || condition.mapMatches(getDelegator(), newValue); - //Debug.logInfo("In storeHook, for entityName [" + entityName + "] shouldRemove is now " + shouldRemove, module); } } else { shouldRemove = true; @@ -211,12 +210,13 @@ public abstract class AbstractEntityConditionCache extends AbstractCache { public GenericValue get(GenericPK pk) { UtilCache entityCache = getCache(pk.getEntityName()); - if (entityCache == null) return null; + if (entityCache == null) { + return null; + } return entityCache.get(pk); } public GenericValue put(GenericValue entity) { - if (entity == null) return null; + if (entity == null) { + return null; + } return put(entity.getPrimaryKey(), entity); } @@ -63,11 +67,17 @@ public class EntityCache extends AbstractCache { public void remove(String entityName, EntityCondition condition) { UtilCache entityCache = getCache(entityName); - if (entityCache == null) return; + if (entityCache == null) { + return; + } for (GenericPK pk: entityCache.getCacheLineKeys()) { GenericValue entity = entityCache.get(pk); - if (entity == null) continue; - if (condition.entityMatches(entity)) entityCache.remove(pk); + if (entity == null) { + continue; + } + if (condition.entityMatches(entity)) { + entityCache.remove(pk); + } } } @@ -77,8 +87,12 @@ public class EntityCache extends AbstractCache { public GenericValue remove(GenericPK pk) { UtilCache entityCache = getCache(pk.getEntityName()); - if (Debug.verboseOn()) Debug.logVerbose("Removing from EntityCache with PK [" + pk + "], will remove from this cache: " + (entityCache == null ? "[No cache found to remove from]" : entityCache.getName()), module); - if (entityCache == null) return null; + if (Debug.verboseOn()) { + Debug.logVerbose("Removing from EntityCache with PK [" + pk + "], will remove from this cache: " + (entityCache == null ? "[No cache found to remove from]" : entityCache.getName()), module); + } + if (entityCache == null) { + return null; + } GenericValue retVal = entityCache.remove(pk); ModelEntity model = pk.getModelEntity(); if (model != null) { @@ -88,7 +102,9 @@ public class EntityCache extends AbstractCache { UtilCache.clearCache(getCacheName(targetEntityName)); } } - if (Debug.verboseOn()) Debug.logVerbose("Removing from EntityCache with PK [" + pk + "], found this in the cache: " + retVal, module); + if (Debug.verboseOn()) { + Debug.logVerbose("Removing from EntityCache with PK [" + pk + "], found this in the cache: " + retVal, module); + } return retVal; } } diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/cache/EntityListCache.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/cache/EntityListCache.java index 31da202161..52219b34a4 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/cache/EntityListCache.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/cache/EntityListCache.java @@ -44,13 +44,17 @@ public class EntityListCache extends AbstractEntityConditionCache get(String entityName, EntityCondition condition, List orderBy) { ConcurrentMap> conditionCache = getConditionCache(entityName, condition); - if (conditionCache == null) return null; + if (conditionCache == null) { + return null; + } Object orderByKey = getOrderByKey(orderBy); List valueList = conditionCache.get(orderByKey); if (valueList == null) { // the valueList was not found for the given ordering, so grab the first one and order it in memory Iterator> it = conditionCache.values().iterator(); - if (it.hasNext()) valueList = it.next(); + if (it.hasNext()) { + valueList = it.next(); + } if (valueList != null) { // Does not need to be synchronized; if 2 threads do the same ordering,