Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 99731 invoked from network); 18 May 2009 21:01:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 May 2009 21:01:24 -0000 Received: (qmail 46007 invoked by uid 500); 18 May 2009 21:01:24 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 45949 invoked by uid 500); 18 May 2009 21:01:24 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 45940 invoked by uid 99); 18 May 2009 21:01:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 May 2009 21:01:24 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 May 2009 21:01:20 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 48F30238893B; Mon, 18 May 2009 21:00:59 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090518210059.48F30238893B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 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 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 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