You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2010/05/11 17:44:57 UTC

svn commit: r943149 - /felix/trunk/framework/src/main/java/org/apache/felix/framework/FilterImpl.java

Author: rickhall
Date: Tue May 11 15:44:57 2010
New Revision: 943149

URL: http://svn.apache.org/viewvc?rev=943149&view=rev
Log:
Improve handling of case insensitive keys. (FELIX-2039)

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/FilterImpl.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/FilterImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/FilterImpl.java?rev=943149&r1=943148&r2=943149&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/FilterImpl.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/FilterImpl.java Tue May 11 15:44:57 2010
@@ -22,7 +22,6 @@ import java.util.ArrayList;
 import java.util.Dictionary;
 import java.util.Enumeration;
 import java.util.List;
-import javax.crypto.spec.IvParameterSpec;
 import org.apache.felix.framework.capabilityset.Attribute;
 import org.apache.felix.framework.capabilityset.Capability;
 import org.apache.felix.framework.capabilityset.CapabilitySet;
@@ -87,10 +86,10 @@ public class FilterImpl implements Filte
 
         public DictionaryCapability(Dictionary dict, boolean caseSensitive)
         {
+            m_dict = dict;
             if (!caseSensitive)
             {
-                m_dict = null;
-                m_map = new StringMap(caseSensitive);
+                m_map = new StringMap(false);
                 if (dict != null)
                 {
                     Enumeration keys = dict.keys();
@@ -99,7 +98,7 @@ public class FilterImpl implements Filte
                         Object key = keys.nextElement();
                         if (m_map.get(key) == null)
                         {
-                            m_map.put(key, new Attribute((String) key, dict.get(key), false));
+                            m_map.put(key, key);
                         }
                         else
                         {
@@ -112,7 +111,6 @@ public class FilterImpl implements Filte
             else
             {
                 m_map = null;
-                m_dict = dict;
             }
         }
 
@@ -138,13 +136,17 @@ public class FilterImpl implements Filte
 
         public Attribute getAttribute(String name)
         {
-            if (m_map != null)
+            String key = name;
+            Object value = null;
+            if (m_dict != null)
             {
-                return (Attribute) m_map.get(name);
+                if (m_map != null)
+                {
+                    key = (String) m_map.get(name);
+                }
+                value = m_dict.get(key);
             }
-
-            Object value = m_dict.get(name);
-            return (value == null) ? null : new Attribute(name, value, false);
+            return (value == null) ? null : new Attribute(key, value, false);
         }
 
         public List<Attribute> getAttributes()
@@ -203,4 +205,4 @@ public class FilterImpl implements Filte
             throw new UnsupportedOperationException("Not supported yet.");
         }
     }
-}
+}
\ No newline at end of file