You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2018/01/17 12:51:37 UTC

[karaf-cellar] branch master updated: [KARAF-5560] Bypass synchronization if whitelist/blacklist configuration is not set

This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf-cellar.git


The following commit(s) were added to refs/heads/master by this push:
     new 07b6dd0  [KARAF-5560] Bypass synchronization if whitelist/blacklist configuration is not set
07b6dd0 is described below

commit 07b6dd03623db2a3f15088381afb3c8f067b48a7
Author: Thomas Draier <td...@jahia.com>
AuthorDate: Mon Jan 8 10:33:28 2018 +0100

    [KARAF-5560] Bypass synchronization if whitelist/blacklist configuration is not set
---
 .../org/apache/karaf/cellar/core/CellarSupport.java  | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java b/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java
index b597e97..9ee4e87 100644
--- a/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java
+++ b/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java
@@ -176,8 +176,14 @@ public class CellarSupport {
         Set<String> whiteList = getListEntries(Configurations.WHITELIST, group, category, type);
         Set<String> blackList = getListEntries(Configurations.BLACKLIST, group, category, type);
 
+        if (blackList == null || whiteList == null) {
+            // If one list is missing, we probably have a configuration issue - do not synchronize anything
+            LOGGER.warn("No whitelist/blacklist found for " + group.getName() + ", check your configuration !");
+            return false;
+        }
+
         // if no white listed items we assume all are accepted.
-        if (whiteList != null && !whiteList.isEmpty()) {
+        if (!whiteList.isEmpty()) {
             result = false;
             for (String whiteListItem : whiteList) {
                 if (wildCardMatch(event, whiteListItem))
@@ -185,11 +191,13 @@ public class CellarSupport {
             }
         }
 
-        // if any blackList item matched, then false is returned.
-        if (blackList != null && !blackList.isEmpty()) {
-            for (String blackListItem : blackList) {
-                if (wildCardMatch(event, blackListItem)) {
-                    result = false;
+        if (result) {
+            // if any blackList item matched, then false is returned.
+            if (!blackList.isEmpty()) {
+                for (String blackListItem : blackList) {
+                    if (wildCardMatch(event, blackListItem)) {
+                        return false;
+                    }
                 }
             }
         }

-- 
To stop receiving notification emails like this one, please contact
['"commits@karaf.apache.org" <co...@karaf.apache.org>'].