You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2007/01/15 15:55:07 UTC

svn commit: r496351 - /directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributesImpl.java

Author: elecharny
Date: Mon Jan 15 06:55:06 2007
New Revision: 496351

URL: http://svn.apache.org/viewvc?view=rev&rev=496351
Log:
Added a special check if we try to add '*' or '+' as an ID :lowercasing them directly is wrong :)

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

Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributesImpl.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributesImpl.java?view=diff&rev=496351&r1=496350&r2=496351
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributesImpl.java (original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributesImpl.java Mon Jan 15 06:55:06 2007
@@ -367,7 +367,18 @@
     {
     	if ( attrId != null )
     	{
-    		Holder holder = (Holder)keyMap.get( StringTools.toLowerCase( attrId ) );
+            String key = null;
+            
+            if ( "+".equals( attrId ) || "*".equals( attrId ) ) 
+            {
+                key = attrId;
+            }
+            else
+            {
+                key = StringTools.toLowerCase( attrId );
+            }
+            
+    		Holder holder = (Holder)keyMap.get( key );
     		return holder != null ? holder.attribute : null;
     	}
     	else
@@ -452,13 +463,25 @@
      *            the character case of its attribute ids, the case of attr's
      *            identifier is ignored.
      *            The store attribute is a clone of the given attribute.
+     *            We have two special attribute names : '+' and '*'
      * @return The Attribute with the same ID as attr that was previous in this
      *         attribute set; The new attr if no such attribute existed.
      * @see #remove
      */
     public Attribute put( Attribute attr )
     {
-    	String key = StringTools.toLowerCase( attr.getID() );
+        String id = attr.getID();
+        String key = null;
+        
+        if ( "+".equals( id ) || "*".equals(  id  ) )
+        {
+            key = id;
+        }
+        else
+        {
+            key = StringTools.toLowerCase( attr.getID() );
+        }
+        
         Attribute old = null;
         Attribute newAttr = attr;