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 e49b0af  Fixed: Fix some bugs Spotbugs reports (OFBIZ-12386)
e49b0af is described below

commit e49b0afbab2eed0215011a5ec7b46b19209c3eb5
Author: Jacques Le Roux <jacques.le.r...@les7arts.com>
AuthorDate: Thu Nov 18 13:26:15 2021 +0100

    Fixed: Fix some bugs Spotbugs reports (OFBIZ-12386)
    
    Fixes a Spotbugs worry and clarifies code
---
 .../org/apache/ofbiz/webtools/UtilCacheEvents.java | 26 +++++++++++-----------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git 
a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/UtilCacheEvents.java
 
b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/UtilCacheEvents.java
index 73299c0..1e45dfc 100644
--- 
a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/UtilCacheEvents.java
+++ 
b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/UtilCacheEvents.java
@@ -19,10 +19,11 @@
 package org.apache.ofbiz.webtools;
 
 import java.util.Iterator;
-import java.util.Locale;
+import java.util.LinkedList;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
-import java.util.LinkedList;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -210,18 +211,17 @@ public final class UtilCacheEvents {
             if (name == null) {
                 errMsg = UtilProperties.getMessage(ERR_RESOURCE, 
"utilCache.couldNotClearCache", locale) + ".";
                 eventList.add(errMsg);
-            }
-
-            UtilCache<?, ?> utilCache = UtilCache.findCache(name);
-
-            if (utilCache != null) {
-                utilCache.clear();
-                errMsg = UtilProperties.getMessage(ERR_RESOURCE, 
"utilCache.clearCache", UtilMisc.toMap("name", name), locale) + ".";
-                eventList.add(errMsg);
             } else {
-                errMsg = UtilProperties.getMessage(ERR_RESOURCE, 
"utilCache.couldNotClearCacheNotFoundName",
-                        UtilMisc.toMap("name", name), locale) + ".";
-                eventList.add(errMsg);
+                UtilCache<?, ?> utilCache = UtilCache.findCache(name);
+                if (utilCache != null) {
+                    utilCache.clear();
+                    errMsg = UtilProperties.getMessage(ERR_RESOURCE, 
"utilCache.clearCache", UtilMisc.toMap("name", name), locale) + ".";
+                    eventList.add(errMsg);
+                } else {
+                    errMsg = UtilProperties.getMessage(ERR_RESOURCE, 
"utilCache.couldNotClearCacheNotFoundName",
+                            UtilMisc.toMap("name", name), locale) + ".";
+                    eventList.add(errMsg);
+                }
             }
         }
         request.setAttribute("_EVENT_MESSAGE_LIST_", eventList);

Reply via email to