This is an automated email from the ASF dual-hosted git repository. jleroux pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push: new 8fd16cdf49 Fixed: EntityPerformanceTest.groovy shows error in log (OFBIZ-12706) 8fd16cdf49 is described below commit 8fd16cdf4980b40cfdacf71c7fcd18f9d9f078b8 Author: Jacques Le Roux <jacques.le.r...@les7arts.com> AuthorDate: Tue Oct 18 11:44:27 2022 +0200 Fixed: EntityPerformanceTest.groovy shows error in log (OFBIZ-12706) propNames String Array can be empty of the 1st element can be null. In the case of the calling by EntityPerformanceTest the 1st element is null. --- .../org/apache/ofbiz/base/util/cache/UtilCache.java | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/UtilCache.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/UtilCache.java index b3e3b07a45..3f70266c00 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/UtilCache.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/UtilCache.java @@ -38,6 +38,7 @@ import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; +import java.util.stream.Stream; import org.apache.ofbiz.base.concurrent.ExecutionPool; import org.apache.ofbiz.base.util.Debug; @@ -150,18 +151,20 @@ public final class UtilCache<K, V> implements Serializable, EvictionListener<Obj } private static String getPropertyParam(ResourceBundle res, String[] propNames, String parameter) { - try { - for (String propName : propNames) { - String key = propName.concat(".").concat(parameter); - if (res.containsKey(key)) { - try { - return res.getString(key); - } catch (MissingResourceException e) { + if (!Stream.of(propNames).anyMatch(string -> string == null || string.isEmpty())) { + try { + for (String propName : propNames) { + String key = propName.concat(".").concat(parameter); + if (res.containsKey(key)) { + try { + return res.getString(key); + } catch (MissingResourceException e) { + } } } + } catch (Exception e) { + Debug.logWarning(e, "Error getting " + parameter + " value from ResourceBundle for propNames: " + Arrays.toString(propNames), MODULE); } - } catch (Exception e) { - Debug.logWarning(e, "Error getting " + parameter + " value from ResourceBundle for propNames: " + Arrays.toString(propNames), MODULE); } return null; }