directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r496379 - /directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributesImpl.java
Date Mon, 15 Jan 2007 16:03:37 GMT
Author: elecharny
Date: Mon Jan 15 08:03:37 2007
New Revision: 496379

URL: http://svn.apache.org/viewvc?view=rev&rev=496379
Log:
Fixed DIRSERVER-826

Modified:
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributesImpl.java

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributesImpl.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributesImpl.java?view=diff&rev=496379&r1=496378&r2=496379
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributesImpl.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributesImpl.java
Mon Jan 15 08:03:37 2007
@@ -353,7 +353,10 @@
     {
         if ( attrId != null )
         {
-            Holder holder = keyMap.get( StringTools.toLowerCase( attrId ) );
+            String key = idToLowerCase( attrId );
+            
+            Holder holder = (Holder)keyMap.get( key );
+
             return holder != null ? holder.attribute : null;
         }
         else
@@ -424,7 +427,8 @@
         Attribute attr = new AttributeImpl( attrId );
         attr.add( val );
         
-        String key = StringTools.toLowerCase( attrId );
+        String key = idToLowerCase( attrId );
+        
         keyMap.put( key, new Holder( attrId, attr) );
         return attr;
     }
@@ -444,7 +448,9 @@
      */
     public Attribute put( Attribute attr )
     {
-        String key = StringTools.toLowerCase( attr.getID() );
+        String id = attr.getID();
+        String key = idToLowerCase( id );
+
         Attribute old = null;
         Attribute newAttr = attr;
         
@@ -463,7 +469,7 @@
         }
         else if ( attr instanceof BasicAttribute )
         {
-            newAttr = new AttributeImpl( attr.getID() );
+            newAttr = new AttributeImpl( id );
              
             try
             {
@@ -480,7 +486,7 @@
             }
         }
         
-        keyMap.put( key, new Holder( attr.getID(), newAttr ) );
+        keyMap.put( key, new Holder( id, newAttr ) );
         return old;
     }
 
@@ -498,7 +504,7 @@
      */
     public Attribute remove( String attrId )
     {
-        String key = StringTools.toLowerCase( attrId );
+        String key = idToLowerCase( attrId );
         
         if ( keyMap.containsKey( key ) )
         {
@@ -519,6 +525,25 @@
         }
     }
 
+    /**
+     * Private method to allow '*' and '+' attribute ID to be 
+     * accepted as a key.
+     */
+    private String idToLowerCase( String id )
+    {
+        String key = null;
+        
+        if ( "+".equals( id ) || "*".equals(  id  ) )
+        {
+            key = id;
+        }
+        else
+        {
+            key = StringTools.toLowerCase( id );
+        }
+
+        return key;
+    }
 
     /**
      * Makes a shallow copy of the attribute set. The new set contains the same



Mime
View raw message