Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 38152 invoked from network); 6 Oct 2007 12:15:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Oct 2007 12:15:00 -0000 Received: (qmail 52342 invoked by uid 500); 6 Oct 2007 12:14:48 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 52299 invoked by uid 500); 6 Oct 2007 12:14:48 -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 52282 invoked by uid 99); 6 Oct 2007 12:14:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Oct 2007 05:14:48 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED 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; Sat, 06 Oct 2007 12:15:00 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B8AC11A9838; Sat, 6 Oct 2007 05:14:09 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r582482 - /directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java Date: Sat, 06 Oct 2007 12:14:09 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071006121409.B8AC11A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: elecharny Date: Sat Oct 6 05:14:09 2007 New Revision: 582482 URL: http://svn.apache.org/viewvc?rev=582482&view=rev Log: Added a patch to handle cases where we have a missing MatchingRule : a specific exception is thrown instead of a generic one. Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java?rev=582482&r1=582481&r2=582482&view=diff ============================================================================== --- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java (original) +++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AttributeTypeImpl.java Sat Oct 6 05:14:09 2007 @@ -23,6 +23,7 @@ import javax.naming.NamingException; import org.apache.directory.server.schema.registries.Registries; +import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException; import org.apache.directory.shared.ldap.exception.LdapNamingException; import org.apache.directory.shared.ldap.message.ResultCodeEnum; import org.apache.directory.shared.ldap.schema.AbstractAttributeType; @@ -146,7 +147,19 @@ { if ( substrOid == null ) { - return findSubstr( getSuperior() ); + MatchingRule matchingRule = findSubstr( getSuperior() ); + + if ( matchingRule == null ) + { + // We don't have a matching rule for this AT, + // let's return an error. + String message = "No matching rule defined for attribute " + (names != null ? names[0] : "" ) + "[" + oid + "]"; + throw new LdapInvalidAttributeValueException( message, ResultCodeEnum.INAPPROPRIATE_MATCHING ); + } + else + { + return matchingRule; + } } return registries.getMatchingRuleRegistry().lookup( substrOid );