directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r776093 - in /directory: apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/AttributeDescAction.java
Date Mon, 18 May 2009 21:00:59 GMT
Author: elecharny
Date: Mon May 18 21:00:58 2009
New Revision: 776093

URL: http://svn.apache.org/viewvc?rev=776093&view=rev
Log:
Fix for DIRSERVER-1367

Modified:
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/AttributeDescAction.java

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java?rev=776093&r1=776092&r2=776093&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchIT.java
Mon May 18 21:00:58 2009
@@ -1321,6 +1321,59 @@
     
     
     /**
+     * Check if no error occurs if " " is requested.
+     */
+    @Test
+    public void testSearchUserAttributes_Space() throws Exception
+    {
+        LdapContext ctx = ( LdapContext ) getWiredContext( ldapService ).lookup( BASE );
+        SearchControls ctls = new SearchControls();
+
+        ctls.setSearchScope( SearchControls.OBJECT_SCOPE );
+        ctls.setReturningAttributes( new String[]
+            { " " } );
+
+        NamingEnumeration<SearchResult> result = ctx.search( HEATHER_RDN, FILTER, ctls
);
+        result.close();
+    }
+
+    
+    /**
+     * Check if no error occurs if "" is requested.
+     */
+    @Test
+    public void testSearchUserAttributes_EmptyAttrs() throws Exception
+    {
+        LdapContext ctx = ( LdapContext ) getWiredContext( ldapService ).lookup( BASE );
+        SearchControls ctls = new SearchControls();
+
+        ctls.setSearchScope( SearchControls.OBJECT_SCOPE );
+        ctls.setReturningAttributes( new String[]
+            { "" } );
+
+        NamingEnumeration<SearchResult> result = ctx.search( HEATHER_RDN, FILTER, ctls
);
+        result.close();
+    }
+
+    
+    /**
+     * Check if no error occurs if "" is requested.
+     */
+    @Test
+    public void testSearchUserAttributes_NullAttrs() throws Exception
+    {
+        LdapContext ctx = ( LdapContext ) getWiredContext( ldapService ).lookup( BASE );
+        SearchControls ctls = new SearchControls();
+
+        ctls.setSearchScope( SearchControls.OBJECT_SCOPE );
+        ctls.setReturningAttributes( new String[0] );
+
+        NamingEnumeration<SearchResult> result = ctx.search( HEATHER_RDN, FILTER, ctls
);
+        result.close();
+    }
+
+    
+    /**
      * Check if user and operational attributes are present, if both "*" and "+" are requested.
      */
     @Test

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/AttributeDescAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/AttributeDescAction.java?rev=776093&r1=776092&r2=776093&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/AttributeDescAction.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/AttributeDescAction.java
Mon May 18 21:00:58 2009
@@ -66,7 +66,12 @@
         if ( tlv.getLength() != 0 )
         {
             attributeDescription = StringTools.utf8ToString( tlv.getValue().getData() );
-            searchRequest.addAttribute( attributeDescription );
+            
+            // If the attributeDescription is empty, we won't add it
+            if ( !StringTools.isEmpty( attributeDescription.trim() ) ) 
+            {
+                searchRequest.addAttribute( attributeDescription );
+            }
         }
 
         // We can have an END transition



Mime
View raw message