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 2012/04/25 16:19:07 UTC

svn commit: r1330304 - /karaf/cellar/branches/cellar-2.2.x/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java

Author: jbonofre
Date: Wed Apr 25 14:19:07 2012
New Revision: 1330304

URL: http://svn.apache.org/viewvc?rev=1330304&view=rev
Log:
[KARAF-1325] Fix wildcard support when pattern is empty

Modified:
    karaf/cellar/branches/cellar-2.2.x/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java

Modified: karaf/cellar/branches/cellar-2.2.x/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java?rev=1330304&r1=1330303&r2=1330304&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java (original)
+++ karaf/cellar/branches/cellar-2.2.x/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java Wed Apr 25 14:19:07 2012
@@ -37,11 +37,12 @@ public class CellarSupport {
     protected ConfigurationAdmin configurationAdmin;
 
     /**
-     * Lists the BlackList for the specified feature.
+     * Lists the BlackList/WhiteList for the specified category..
      *
-     * @param category
-     * @param group
-     * @return
+     * @param listType whitelist or blacklist.
+     * @param category  the lookup category.
+     * @param group the target group name.
+     * @return the corresponding list entries.
      */
     public Set<String> getListEntries(String listType, String group, String category, EventType type) {
         Set<String> result = null;
@@ -145,8 +146,9 @@ public class CellarSupport {
         if (whiteList != null && !whiteList.isEmpty()) {
             result = false;
             for (String whiteListItem : whiteList) {
-                if (wildCardMatch(event, whiteListItem))
+                if (wildCardMatch(event, whiteListItem)) {
                     result = true;
+                }
             }
         }
 
@@ -171,6 +173,9 @@ public class CellarSupport {
      */
     protected boolean wildCardMatch(String item, String pattern) {
         String[] cards = pattern.split("\\*");
+        if (pattern == null || pattern.isEmpty()) {
+            return false;
+        }
         // Iterate over the cards.
         for (String card : cards) {
             int idx = item.indexOf(card);