FELIX-4489 : [Jetty] Ignore empty (string) entries in configuration arrays

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1595125 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
index d878333..43fc55c 100644
--- a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
+++ b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
@@ -24,6 +24,7 @@
 import java.util.Dictionary;
 import java.util.Hashtable;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Properties;
 
 import org.apache.felix.http.base.internal.logger.SystemLogger;
@@ -518,20 +519,41 @@
         return value;
     }
 
+    /**
+     * Get the property value as a string array.
+     * Empty values are filtered out - if the resulting array is empty
+     * the default value is returned.
+     */
     private String[] getStringArrayProperty(String name, String[] defValue)
     {
         Object value = getProperty(name);
         if (value instanceof String)
         {
-            return new String[] { (String) value };
+            final String stringVal = ((String) value).trim();
+            if ( stringVal.length() > 0 )
+            {
+                return new String[] { stringVal };
+            }
         }
         else if (value instanceof String[])
         {
-            return (String[]) value;
+            final String[] stringArr = (String[]) value;
+            final List<String> list = new ArrayList<String>();
+            for(final String stringVal : stringArr)
+            {
+                if ( stringVal.trim().length() > 0 )
+                {
+                    list.add(stringVal.trim());
+                }
+            }
+            if ( list.size() > 0 )
+            {
+                return list.toArray(new String[list.size()]);
+            }
         }
         else if (value instanceof Collection)
         {
-            ArrayList<String> conv = new ArrayList<String>();
+            final ArrayList<String> conv = new ArrayList<String>();
             for (Iterator<?> vi = ((Collection<?>) value).iterator(); vi.hasNext();)
             {
                 Object object = vi.next();
@@ -540,12 +562,12 @@
                     conv.add(String.valueOf(object));
                 }
             }
-            return conv.toArray(new String[conv.size()]);
+            if ( conv.size() > 0 )
+            {
+                return conv.toArray(new String[conv.size()]);
+            }
         }
-        else
-        {
-            return defValue;
-        }
+        return defValue;
     }
 
     private int parseInt(String value, int dflt)