From e3665de1f2e2eba30cde607c43cc3a6612fd84ff Mon Sep 17 00:00:00 2001 From: Michael Brohl Date: Sat, 28 Oct 2017 13:36:26 +0000 Subject: [PATCH] Improved: Fixing defects reported by FindBugs, package org.apache.ofbiz.entity.cache. (OFBIZ-9711) Thanks Dennis Balkir for reporting and providing the patch. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1813631 13f79535-47bb-0310-9956-ffa450edef68 --- .../cache/AbstractEntityConditionCache.java | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) 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 e310eb7e89..a64a81792c 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 @@ -65,12 +65,10 @@ public abstract class AbstractEntityConditionCache extends AbstractCache it = model.getViewConvertorsIterator(); - while (it.hasNext()) { - String targetEntityName = it.next(); - UtilCache.clearCache(getCacheName(targetEntityName)); - } + Iterator it = model.getViewConvertorsIterator(); + while (it.hasNext()) { + String targetEntityName = it.next(); + UtilCache.clearCache(getCacheName(targetEntityName)); } } @@ -113,7 +111,7 @@ public abstract class AbstractEntityConditionCache extends AbstractCache conditionCache = utilCache.get(conditionKey); if (conditionCache == null) { - conditionCache = new ConcurrentHashMap(); + conditionCache = new ConcurrentHashMap<>(); utilCache.put(conditionKey, conditionCache); } return conditionCache; @@ -166,9 +164,6 @@ public abstract class AbstractEntityConditionCache extends AbstractCache it = model.getViewConvertorsIterator(); while (it.hasNext()) { @@ -180,9 +175,6 @@ public abstract class AbstractEntityConditionCache extends AbstractCache, T2 extends Map> void storeHook(String entityName, boolean isPK, List oldValues, List newValues) { UtilCache> 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; }