svn commit: r1813631 - /ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/cache/AbstractEntityConditionCache.java

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

svn commit: r1813631 - /ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/cache/AbstractEntityConditionCache.java

mbrohl
Author: mbrohl
Date: Sat Oct 28 13:36:26 2017
New Revision: 1813631

URL: http://svn.apache.org/viewvc?rev=1813631&view=rev
Log:
Improved: Fixing defects reported by FindBugs, package
org.apache.ofbiz.entity.cache.
(OFBIZ-9711)

Thanks Dennis Balkir for reporting and providing the patch.

Modified:
    ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/cache/AbstractEntityConditionCache.java

Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/cache/AbstractEntityConditionCache.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/cache/AbstractEntityConditionCache.java?rev=1813631&r1=1813630&r2=1813631&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/cache/AbstractEntityConditionCache.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/cache/AbstractEntityConditionCache.java Sat Oct 28 13:36:26 2017
@@ -65,12 +65,10 @@ public abstract class AbstractEntityCond
     public void remove(GenericEntity entity) {
         UtilCache.clearCache(getCacheName(entity.getEntityName()));
         ModelEntity model = entity.getModelEntity();
-        if (model != null) {
-            Iterator<String> it = model.getViewConvertorsIterator();
-            while (it.hasNext()) {
-                String targetEntityName = it.next();
-                UtilCache.clearCache(getCacheName(targetEntityName));
-            }
+        Iterator<String> it = model.getViewConvertorsIterator();
+        while (it.hasNext()) {
+            String targetEntityName = it.next();
+            UtilCache.clearCache(getCacheName(targetEntityName));
         }
     }
 
@@ -113,7 +111,7 @@ public abstract class AbstractEntityCond
         EntityCondition conditionKey = getConditionKey(condition);
         ConcurrentMap<K, V> conditionCache = utilCache.get(conditionKey);
         if (conditionCache == null) {
-            conditionCache = new ConcurrentHashMap<K, V>();
+            conditionCache = new ConcurrentHashMap<>();
             utilCache.put(conditionKey, conditionCache);
         }
         return conditionCache;
@@ -166,9 +164,6 @@ public abstract class AbstractEntityCond
         ModelEntity model = getModelCheckValid(oldEntity, newEntity);
         String entityName = model.getEntityName();
         // for info about cache clearing
-        if (newEntity == null) {
-            //Debug.logInfo("In storeHook calling sub-storeHook for entity name [" + entityName + "] for the oldEntity: " + oldEntity, module);
-        }
         storeHook(entityName, isPK, UtilMisc.toList(oldEntity), UtilMisc.toList(newEntity));
         Iterator<String> it = model.getViewConvertorsIterator();
         while (it.hasNext()) {
@@ -180,9 +175,6 @@ public abstract class AbstractEntityCond
     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 (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) {
             return;
         }