Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 71226 invoked from network); 21 May 2007 23:59:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 May 2007 23:59:56 -0000 Received: (qmail 96574 invoked by uid 500); 21 May 2007 23:59:56 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 96545 invoked by uid 500); 21 May 2007 23:59:56 -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 96534 invoked by uid 99); 21 May 2007 23:59:56 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 May 2007 16:59:56 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 May 2007 16:59:50 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 0183E1A981A; Mon, 21 May 2007 16:59:30 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r540369 - /directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java Date: Mon, 21 May 2007 23:59:29 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070521235930.0183E1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: elecharny Date: Mon May 21 16:59:29 2007 New Revision: 540369 URL: http://svn.apache.org/viewvc?view=rev&rev=540369 Log: Added a name to the SearchResultFilteringEnumeration constructore for debug purpose Fixed the filterAttributesToReturn method so that invalid attributes are removed from the list of returned attributes. If the list is empty after the removing, then "1.1" is passed to the filter chain. Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java?view=diff&rev=540369&r1=540368&r2=540369 ============================================================================== --- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java (original) +++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java Mon May 21 16:59:29 2007 @@ -380,7 +380,7 @@ { NamingEnumeration e = nextInterceptor.list( opContext ); Invocation invocation = InvocationStack.getInstance().peek(); - return new SearchResultFilteringEnumeration( e, new SearchControls(), invocation, binaryAttributeFilter ); + return new SearchResultFilteringEnumeration( e, new SearchControls(), invocation, binaryAttributeFilter, "List Schema Filter" ); } /** @@ -420,12 +420,21 @@ try { - String oid = registries.getOidRegistry().getOid( attribute ); - - if ( !filteredAttrs.containsKey( oid ) ) - { - filteredAttrs.put( oid, attribute ); - } + // Check that the attribute is declared + if ( registries.getOidRegistry().hasOid( attribute ) ) + { + String oid = registries.getOidRegistry().getOid( attribute ); + + // The attribute must be an AttributeType + if ( registries.getAttributeTypeRegistry().hasAttributeType( oid ) ) + { + if ( !filteredAttrs.containsKey( oid ) ) + { + // Ok, we can add the attribute to the list of filtered attributes + filteredAttrs.put( oid, attribute ); + } + } + } } catch ( NamingException ne ) { @@ -439,6 +448,15 @@ return; } + // Deal with the special case where the attribute list is now empty + if ( filteredAttrs.size() == 0 ) + { + // We just have to pass the special 1.1 ayttribute, + // as we don't want to return any attribute + searchCtls.setReturningAttributes( new String[]{ "1.1" } ); + return; + } + // Some attributes have been removed. let's modify the searchControl String[] newAttributesList = new String[filteredAttrs.size()]; @@ -476,10 +494,10 @@ if ( searchCtls.getReturningAttributes() != null ) { - return new SearchResultFilteringEnumeration( e, new SearchControls(), invocation, topFilter ); + return new SearchResultFilteringEnumeration( e, new SearchControls(), invocation, topFilter, "Search Schema Filter top" ); } - return new SearchResultFilteringEnumeration( e, searchCtls, invocation, filters ); + return new SearchResultFilteringEnumeration( e, searchCtls, invocation, filters, "Search Schema Filter" ); } // The user was searching into the subSchemaSubEntry